{"id":15646410,"url":"https://github.com/azu/safe-marked","last_synced_at":"2025-10-10T07:38:23.292Z","repository":{"id":35019905,"uuid":"196189257","full_name":"azu/safe-marked","owner":"azu","description":"Markdown to HTML using marked and DOMPurify. Safe by default.","archived":false,"fork":false,"pushed_at":"2025-10-07T13:35:06.000Z","size":1316,"stargazers_count":51,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T15:28:07.391Z","etag":null,"topics":["converter","html","markdown","safe","sanitize","xss"],"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":{"funding":{"github":"azu"},"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-10T11:03:14.000Z","updated_at":"2025-06-30T19:09:51.000Z","dependencies_parsed_at":"2024-06-01T18:54:14.976Z","dependency_job_id":"d848f516-7932-4f94-83a7-38c936f853ea","html_url":"https://github.com/azu/safe-marked","commit_stats":{"total_commits":797,"total_committers":4,"mean_commits":199.25,"dds":0.437892095357591,"last_synced_commit":"22a13b1233ecbad82a4fc144f7abb09cfc6b5b5e"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/azu/safe-marked","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fsafe-marked","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fsafe-marked/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fsafe-marked/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fsafe-marked/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/safe-marked/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fsafe-marked/sbom","scorecard":{"id":113569,"data":{"date":"2025-08-11","repo":{"name":"github.com/azu/safe-marked","commit":"a72dd9b680ebe6135ab6268f4a550e6727c7f961"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.2,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":4,"reason":"5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":5,"reason":"dependency not pinned by hash detected -- score normalized to 5","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/azu/safe-marked/test.yml/master?enable=pin","Info:   1 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/test.yml:6","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":9,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/azu/.github/SECURITY.md:1","Info: Found linked content: github.com/azu/.github/SECURITY.md:1","Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy","Info: Found text in security policy: github.com/azu/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-vhxf-7vqr-mrjg","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T19:28:20.123Z","repository_id":35019905,"created_at":"2025-08-15T19:28:20.123Z","updated_at":"2025-08-15T19:28:20.123Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003185,"owners_count":26083533,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["converter","html","markdown","safe","sanitize","xss"],"created_at":"2024-10-03T12:12:46.665Z","updated_at":"2025-10-10T07:38:23.252Z","avatar_url":"https://github.com/azu.png","language":"TypeScript","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"readme":"# safe-marked [![Actions Status: test](https://github.com/azu/safe-marked/workflows/test/badge.svg)](https://github.com/azu/safe-marked/actions?query=workflow%3A\"test\")\n\nConvert Markdown to HTML using [marked](https://marked.js.org) and [DOMPurify](https://github.com/cure53/DOMPurify).\n\n## Motivation\n\n[marked](https://marked.js.org) does not sanitized by default.\nAlso, [marked](https://marked.js.org) will remove `sanitize` option in the future.\n\nWe want to get safe and easy library that convert Markdown to HTML.\n\n## Features\n\n- Convert Markdown to HTML using [marked](https://marked.js.org)\n- Safe by default\n    - The output is sanitized by [DOMPurify](https://github.com/cure53/DOMPurify)\n- Type Safe by default\n    - This library is written by TypeScript\n- Work on Browser and Node.js\n\n## Size\n\n      package           size      minified  gzipped\n      safe-marked       90.15 KB  39.36 KB  13.82 KB (browser bundle size)\n      marked@0.7.0      45.05 KB  23.87 KB  7.87 KB\n      dompurify@1.0.11  45.21 KB  15.3 KB   5.99 KB\n      \n      # Other Markdown library  \n      markdown-it@9.0.0  325.52 KB  92.69 KB  32.77 KB\n      showdown@1.9.0     157.28 KB  71.06 KB  23.55 KB\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n    npm install safe-marked\n\n## Usage\n\n```js\nimport { createMarkdown } from \"safe-marked\";\nconst markdown = createMarkdown();\nconst html = markdown(`# Header\n\nThis is [CommonMark](https://commonmark.org/) text.\n`);\nconsole.log(html); \n/* \u003ch1 id=\"header\"\u003eHeader\u003c/h1\u003e\n   \u003cp\u003eThis is \u003ca href=\"https://commonmark.org/\"\u003eCommonMark\u003c/a\u003e text.\u003c/p\u003e\n*/\n```\n\nThe output is sanitized by default.\n\n```js\nimport { createMarkdown } from \"safe-marked\";\nconst markdown = createMarkdown();\nconst html = markdown(`\u003cscript\u003ealert(1)\u003c/script\u003e\n\u003ciframe src=\"https://example.com\"\u003e\u003c/iframe\u003e\n\nThis is [XSS](javascript:alert(1))`);\n// sanitized by default\nassert.strictEqual(html, `\n\n\u003cp\u003eThis is \u003ca\u003eXSS\u003c/a\u003e\u003c/p\u003e\n`);\n```\n\n### Options\n\nYou can pass options for these library.\n\n- `marked`: See [marked](https://marked.js.org/#/USING_ADVANCED.md)'s options\n  - `onInit(marked: Marked): unknown`: You can use `onInit` to customize `marked` instance.\n  - It is useful to add a plugin to `marked`.\n- `dompurify`: See [DOMPurify](https://github.com/cure53/DOMPurify)'s options\n\nAn example for options:\n\n```js\nimport { createMarkdown } from \"safe-marked\";\nimport { gfmHeadingId } from \"marked-gfm-heading-id\";\nconst markdown = createMarkdown({\n    marked: {\n        // Add plugin to marked\n        onInit(marked) {\n            // add plugin\n            marked.use(gfmHeadingId());\n        },\n        // same options for https://marked.js.org/#/USING_ADVANCED.md\n        gfm: false\n    },\n    // same options for https://github.com/cure53/DOMPurify\n    dompurify: {\n        ADD_TAGS: [\"iframe\"]\n    }\n});\nconst html = markdown(`# Header\n\n\u003ciframe src=\"https://example.com\"\u003e\u003c/iframe\u003e\nThis is [CommonMark](https://commonmark.org/) text.\n`);\nassert.strictEqual(html, `\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## FAQ\n\n### Does safe-marked always include jsdom?\n\nNo. safe-marked has two type of entry point.\n\n- Node.js\n- Browser\n\nBrowser entrypoint does not includes jsdom. (just use marked + dompurify)\n\n- [Automatically include jsdom? · Issue #5 · azu/safe-marked](https://github.com/azu/safe-marked/issues/5)\n\nBrowser demo: \u003chttps://stackblitz.com/edit/js-pquqgx?file=index.js,package.json\u003e\n\n## Changelog\n\nSee [Releases page](https://github.com/azu/safe-marked/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/safe-marked/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## License\n\nMIT © azu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fsafe-marked","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fsafe-marked","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fsafe-marked/lists"}