{"id":15756083,"url":"https://github.com/azu/marked-plugin-sanitizer","last_synced_at":"2025-03-31T08:19:42.344Z","repository":{"id":66143489,"uuid":"257619392","full_name":"azu/marked-plugin-sanitizer","owner":"azu","description":"[WIP] marked plugin to sanitize HTML","archived":false,"fork":false,"pushed_at":"2020-04-21T14:39:00.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T12:47:52.018Z","etag":null,"topics":["escape","html","marked","plugin","sanitize"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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},"funding":{"github":"azu"}},"created_at":"2020-04-21T14:19:16.000Z","updated_at":"2020-05-22T01:11:27.000Z","dependencies_parsed_at":"2023-02-21T16:45:14.993Z","dependency_job_id":null,"html_url":"https://github.com/azu/marked-plugin-sanitizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmarked-plugin-sanitizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmarked-plugin-sanitizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmarked-plugin-sanitizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmarked-plugin-sanitizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/marked-plugin-sanitizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246436339,"owners_count":20776995,"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":["escape","html","marked","plugin","sanitize"],"created_at":"2024-10-04T08:41:44.806Z","updated_at":"2025-03-31T08:19:42.306Z","avatar_url":"https://github.com/azu.png","language":"TypeScript","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"readme":"# marked-plugin-sanitizer\n\n[marked](https://github.com/markedjs/marked) plugin to sanitize HTML\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n    npm install marked-plugin-sanitizer\n\n## Usage\n\n```js\nconst marked = require(\"marked\");\nconst { createSanitizer } = require(\"marked-plugin-sanitizer\");\nmarked.use(createSanitizer());\nconst html = marked(`\u003cscript\u003ealert(1)\u003c/script\u003e\n\u003ciframe src=\"https://example.com\"\u003e\u003c/iframe\u003e\n\nThis is [XSS](javascript:alert)`);\n\nconsole.log(html)\n/*\n\n\u003cp\u003eThis is \u003ca\u003eXSS\u003c/a\u003e\u003c/p\u003e\n\n*/\n```\n\n### Options: \n\n- `dompurify`: See [DOMPurify](https://github.com/cure53/DOMPurify)'s options\n\nAn example for options:\n\n```js\nconst marked = require(\"marked\");\nconst { createSanitizer } = require(\"marked-plugin-sanitizer\");\nmarked.setOptions({\n    headerIds: false,\n});\nmarked.use(\n    createSanitizer({\n        dompurify: {\n            ADD_TAGS: [\"iframe\"],\n        },\n    })\n);\nconst html = marked(`# Header\n\n\u003ciframe src=\"https://example.com\"\u003e\u003c/iframe\u003e\nThis is [CommonMark](https://commonmark.org/) text.\n`);\nassert.strictEqual(\n    html,\n    `\u003ch1\u003eHeader\u003c/h1\u003e\n\u003ciframe src=\"https://example.com\"\u003e\u003c/iframe\u003e\nThis is [CommonMark](https://commonmark.org/) text.\n`\n);\n```\n\n## Changelog\n\nSee [Releases page](https://github.com/azu/marked-plugin-sanitizer/releases).\n\n## Running tests\n\nInstall devDependencies and Run `npm test`:\n\n    npm test\n\n## Contributing\n\nPull requests and stars are always welcome.\n\nFor bugs and feature requests, [please create an issue](https://github.com/azu/marked-plugin-sanitizer/issues).\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## Author\n\n- [github/azu](https://github.com/azu)\n- [twitter/azu_re](https://twitter.com/azu_re)\n\n## License\n\nMIT © azu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fmarked-plugin-sanitizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fmarked-plugin-sanitizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fmarked-plugin-sanitizer/lists"}