{"id":13439295,"url":"https://github.com/veddan/rust-htmlescape","last_synced_at":"2025-12-12T16:51:50.674Z","repository":{"id":40545844,"uuid":"11776861","full_name":"veddan/rust-htmlescape","owner":"veddan","description":"A HTML entity encoding library for Rust","archived":false,"fork":false,"pushed_at":"2023-05-31T17:48:13.000Z","size":103,"stargazers_count":41,"open_issues_count":7,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-19T20:38:40.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veddan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-30T22:17:27.000Z","updated_at":"2024-06-17T12:23:20.000Z","dependencies_parsed_at":"2024-06-19T01:45:14.331Z","dependency_job_id":null,"html_url":"https://github.com/veddan/rust-htmlescape","commit_stats":{"total_commits":60,"total_committers":2,"mean_commits":30.0,"dds":0.06666666666666665,"last_synced_commit":"1699b539179798e705ad8464128492a0a0092876"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veddan%2Frust-htmlescape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veddan%2Frust-htmlescape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veddan%2Frust-htmlescape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veddan%2Frust-htmlescape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veddan","download_url":"https://codeload.github.com/veddan/rust-htmlescape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221739682,"owners_count":16872773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:12.747Z","updated_at":"2025-12-12T16:51:45.648Z","avatar_url":"https://github.com/veddan.png","language":"Rust","readme":"# A HTML entity encoding library for Rust\n[![Build Status](https://travis-ci.org/veddan/rust-htmlescape.png?branch=master)](https://travis-ci.org/veddan/rust-htmlescape)\n\n## Example usage\nAll example assume a `extern crate htmlescape;` and `use htmlescape::{relevant functions here};` is present.\n\n###Encoding\n`htmlescape::encode_minimal()` encodes an input string using a minimal set of HTML entities.\n\n```rust\nlet title = \"Cats \u0026 dogs\";\nlet tag = format!(\"\u003ctitle\u003e{}\u003c/title\u003e\", encode_minimal(title));\nassert_eq!(tag.as_slice(), \"\u003ctitle\u003eCats \u0026amp; dogs\u003c/title\u003e\");\n```\n\nThere is also a `htmlescape::encode_attribute()` function for encoding strings that are to be used\nas html attribute values.\n\n###Decoding\n`htmlescape::decode_html()` decodes an encoded string, replacing HTML entities with the\ncorresponding characters. Named, hex, and decimal entities are supported. A `Result` value is\nreturned, with either the decoded string in `Ok`, or an error in `Err`.\n\n```rust\nlet encoded = \"Cats\u0026#x20;\u0026amp;\u0026#32;dogs\";\nlet decoded = match decode_html(encoded) {\n  Err(reason) =\u003e panic!(\"Error {:?} at character {}\", reason.kind, reason.position),\n  Ok(s) =\u003e s\n};\nassert_eq!(decoded.as_slice(), \"Cats \u0026 dogs\");\n```\n\n###Avoiding allocations\nBoth the encoding and decoding functions are available in forms that take a `Writer` for output rather\nthan returning an `String`. These version can be used to avoid allocation and copying if the returned\n`String` was just going to be written to a `Writer` anyway.\n","funding_links":[],"categories":["Libraries","库","库 Libraries"],"sub_categories":["Encoding","编码(Encoding)","加密 Encoding"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveddan%2Frust-htmlescape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveddan%2Frust-htmlescape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveddan%2Frust-htmlescape/lists"}