{"id":24527713,"url":"https://github.com/zsmatrix62/diff-html","last_synced_at":"2025-06-28T11:06:53.753Z","repository":{"id":273339762,"uuid":"919362914","full_name":"zsmatrix62/diff-html","owner":"zsmatrix62","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-24T12:48:07.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T19:51:41.150Z","etag":null,"topics":["diff-html","extism"],"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/zsmatrix62.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":"2025-01-20T08:57:13.000Z","updated_at":"2025-04-28T16:29:19.000Z","dependencies_parsed_at":"2025-01-20T10:33:27.664Z","dependency_job_id":"85321cf7-4515-44b9-a446-87d68e9880c9","html_url":"https://github.com/zsmatrix62/diff-html","commit_stats":null,"previous_names":["zsmatrix62/diff-html"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zsmatrix62/diff-html","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsmatrix62%2Fdiff-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsmatrix62%2Fdiff-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsmatrix62%2Fdiff-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsmatrix62%2Fdiff-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zsmatrix62","download_url":"https://codeload.github.com/zsmatrix62/diff-html/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsmatrix62%2Fdiff-html/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262419809,"owners_count":23308100,"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":["diff-html","extism"],"created_at":"2025-01-22T06:20:17.173Z","updated_at":"2025-06-28T11:06:53.733Z","avatar_url":"https://github.com/zsmatrix62.png","language":"Rust","readme":"# diff-html\n\nA WebAssembly plugin for Extism that performs HTML diffing between two HTML documents.\n\nFor more information about using Extism plugins, see the [Extism official documentation](https://extism.org/docs/overview).\n\n## Features\n\n- Performs semantic HTML diffing\n- Preserves document structure\n- Highlights changes with \u003cins\u003e and \u003cdel\u003e tags\n- Works as a lightweight WebAssembly module\n\n## Example\n\n### Input JSON\n```json\n{\n  \"before\": \"\u003cdiv\u003e\u003cp\u003eOriginal content with some text\u003c/p\u003e\u003c/div\u003e\",\n  \"after\": \"\u003cdiv\u003e\u003cp\u003eModified content with different text\u003c/p\u003e\u003c/div\u003e\"\n}\n```\n\n### Output HTML\n```html\n\u003cdiv\u003e\n  \u003cp\u003e\n    \u003cdel\u003eOriginal\u003c/del\u003e\u003cins\u003eModified\u003c/ins\u003e content \n    \u003cdel\u003ewith some\u003c/del\u003e\u003cins\u003ewith different\u003c/ins\u003e text\n  \u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Rendered Output\n```html\n\u003cdiv\u003e\n  \u003cp\u003e\n    \u003cdel style=\"color:red; text-decoration:line-through\"\u003eOriginal\u003c/del\u003e\n    \u003cins style=\"color:green; text-decoration:underline\"\u003eModified\u003c/ins\u003e content \n    \u003cdel style=\"color:red; text-decoration:line-through\"\u003ewith some\u003c/del\u003e\n    \u003cins style=\"color:green; text-decoration:underline\"\u003ewith different\u003c/ins\u003e text\n  \u003c/p\u003e\n\u003c/div\u003e\n```\n\n## Installation\n\n1. Install Extism CLI and Rust toolchain:\n   ```bash\n   make setup\n   ```\n\n2. Build the optimized WebAssembly module:\n   ```bash\n   make build\n   ```\n\n3. The compiled WebAssembly module will be available at:\n   ```\n   target/wasm32-unknown-unknown/release/diff_html.wasm\n   ```\n\n## Usage with Extism\n\n### Rust Example\n\n```rust\nuse extism_pdk::*;\n\n#[plugin_fn]\npub fn diff_html(input: String) -\u003e FnResult\u003cString\u003e {\n    let input: serde_json::Value = serde_json::from_str(\u0026input)?;\n    \n    let before = input[\"before\"].as_str().unwrap();\n    let after = input[\"after\"].as_str().unwrap();\n    \n    let result = diff_html_rs::diff(before, after);\n    Ok(result)\n}\n```\n\n### JavaScript Example\n\n```javascript\nimport { Plugin } from 'extism';\n\nasync function diffHtml(before, after) {\n  const plugin = await Plugin.fromWasmFile(\n    './target/wasm32-unknown-unknown/release/diff_html.wasm'\n  );\n\n  const input = JSON.stringify({\n    before,\n    after\n  });\n\n  const output = await plugin.call('diff_html', input);\n  return output.text();\n}\n\n// Example usage\nconst beforeHtml = '\u003cdiv class=\"container\"\u003e\u003cp id=\"p1\"\u003eContent\u003c/p\u003e\u003c/div\u003e';\nconst afterHtml = '\u003cdiv class=\"wrapper\"\u003e\u003cp id=\"p1\" style=\"color:red\"\u003eModified Content\u003c/p\u003e\u003c/div\u003e';\n\ndiffHtml(beforeHtml, afterHtml).then(result =\u003e {\n  console.log('Diff result:', result);\n});\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsmatrix62%2Fdiff-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzsmatrix62%2Fdiff-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsmatrix62%2Fdiff-html/lists"}