{"id":30659640,"url":"https://github.com/hilookas/markdown-it-directive-webcomponents","last_synced_at":"2026-02-23T23:34:00.824Z","repository":{"id":45043361,"uuid":"261503627","full_name":"hilookas/markdown-it-directive-webcomponents","owner":"hilookas","description":"Convert a markdown directive to a web component.","archived":false,"fork":false,"pushed_at":"2022-01-12T23:03:19.000Z","size":18,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-31T13:02:21.299Z","etag":null,"topics":["markdown","markdown-it","markdown-it-plugin","react","vue","webcomponents"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/hilookas.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}},"created_at":"2020-05-05T15:02:35.000Z","updated_at":"2022-08-21T19:01:33.000Z","dependencies_parsed_at":"2022-09-02T23:23:40.112Z","dependency_job_id":null,"html_url":"https://github.com/hilookas/markdown-it-directive-webcomponents","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hilookas/markdown-it-directive-webcomponents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilookas%2Fmarkdown-it-directive-webcomponents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilookas%2Fmarkdown-it-directive-webcomponents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilookas%2Fmarkdown-it-directive-webcomponents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilookas%2Fmarkdown-it-directive-webcomponents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hilookas","download_url":"https://codeload.github.com/hilookas/markdown-it-directive-webcomponents/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilookas%2Fmarkdown-it-directive-webcomponents/sbom","scorecard":{"id":464855,"data":{"date":"2025-08-11","repo":{"name":"github.com/hilookas/markdown-it-directive-webcomponents","commit":"943d5b578b7c2f822130424707d1ffac4275da1c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"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":"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":"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":"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":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6vfc-qv3f-vr6c"],"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-19T12:12:38.925Z","repository_id":45043361,"created_at":"2025-08-19T12:12:38.925Z","updated_at":"2025-08-19T12:12:38.925Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29760667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T21:02:23.375Z","status":"ssl_error","status_checked_at":"2026-02-23T20:58:31.539Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["markdown","markdown-it","markdown-it-plugin","react","vue","webcomponents"],"created_at":"2025-08-31T13:02:12.872Z","updated_at":"2026-02-23T23:34:00.808Z","avatar_url":"https://github.com/hilookas.png","language":"JavaScript","readme":"# markdown-it-directive-webcomponents\n\n[中文指南](README.zh.md)\n\nThis plugin can convert a markdown directive ([Generic directives/plugins syntax spec](https://talk.commonmark.org/t/generic-directives-plugins-syntax/444)) to a web component ([WebComponents](https://developer.mozilla.org/en-US/docs/Web/Web_Components)). It needs [markdown-it-directive](https://github.com/hilookas/markdown-it-directive) and [markdown-it](https://github.com/markdown-it/markdown-it) as dependencies.\n\n## Install\n\n`npm i markdown-it-directive-webcomponents`\n\n## API\n\n```javascript\nconst md = require('markdown-it')()\n  .use(require('markdown-it-directive-webcomponents'), {\n    components: [\n      {\n        present: 'both',\n        name: 'directive-name',\n        tag: 'tag-name',\n        allowedAttrs: [ 'inline', 'src', 'title', /^prefix/ ],\n        destLinkName: 'my-link-name',\n        destStringName: 'my-string-name',\n        parseInner: true\n      },\n    ]\n  });\n```\n\n- `components`: Write conversion rules in this array\n  - `present`: Which type of directive to parse. Values: `inline`, `block`, `both`.\n  - `name`: The name of the directive\n  - `tag`: The tag name of the converted component\n  - `allowedAttrs`: Allowed attribute names. If set as an array, elements in the array can be a String or a RegEx. If not set, allow any name. (has security issues, not recommended)\n  - `destLinkName`: Attribute name when converting link-type data in link destinations (ie. the content in `()`) to attributes. `src` by default\n  - `destStringName`: Attribute name when converting string-type data in link destinations to attributes. `title` by default\n  - `parseInner`: Whether to continue to parse the content as Markdown or not. Bool type. if it is `false`, the content will be unescaped and written in the output (html `\u003c \u003e` etc. will still be escaped).\n\n\n[DOMPurify](https://github.com/cure53/DOMPurify) is recommended as a security backup.\n\nHere are three directive formats that can be recognized:\n\n```text\ntext before :directive-name[content](/link \"destination\" /another \"one\"){.class #id name=value name=\"string!\"} text after\n\n:: directive-name [inline content] (/link \"destination\" /another \"one\") {.class #id name=value name=\"string!\"} content title ::\n\n::: directive-name [inline content] (/link \"destination\" /another \"one\") {.class #id name=value name=\"string!\"} content title ::\ncontent\n:::\n```\n\nWill be converted to:\n\n```html\n\u003cp\u003etext before \u003ctag-name class=\"class\" id=\"id\" name=\"value\" src=\"/link\" title=\"destination\" inline=\"\"\u003econtent\u003c/tag-name\u003e text after\u003c/p\u003e\n\n\u003ctag-name class=\"class\" id=\"id\" name=\"value\" src=\"/link\" title=\"destination\"\u003einline content\u003c/tag-name\u003e\n\n\u003ctag-name class=\"class\" id=\"id\" name=\"value\" src=\"/link\" title=\"destination\"\u003e\n\u003cp\u003econtent\u003c/p\u003e\n\u003c/tag-name\u003e\n```\n\nIn the conversion process, link-type value which in `()` will add to `src` attribute, and string-type value will add to `title` attribute. `class`'s values will be merged together and other attributes will pick the first value.\n\nBlock-level directive, if it is the third case, it will ignore the inline content and content title, and parse the content as block; if the second case, if there is, then use inline content otherwise use content title as content and parse the content as inline.\n\n## Example\n\n```javascript\nconst md = require('markdown-it')()\n  .use(require('markdown-it-directive-webcomponents'), {\n    components: [\n      {\n        present: 'both',\n        name: 'directive-name',\n        tag: 'tag-name',\n        allowedAttrs: [ 'inline', 'src', 'title', /^prefix/ ],\n        parseInner: true\n      },\n      {\n        present: 'both',\n        name: 'another-directive',\n        tag: 'another-tag',\n        allowedAttrs: [ 'inline', 'src', 'title', /^prefix/ ],\n        parseInner: false\n      },\n    ]\n  });\n\nconsole.dir(md.render(`\ntext before :directive-name[content](/link \"destination\" /another \"one\"){.class #id name=value name=\"string!\"} text after\n\n:: directive-name [inline content] (/link \"destination\" /another \"one\") {.class #id name=value name=\"string!\"} content title ::\n\n::: directive-name [inline content] (/link \"destination\" /another \"one\") {.class #id name=value name=\"string!\"} content title ::\ncontent\n:::\n\n::: another-directive\ncontent\n\\\\:::\n:::`));\n\n/* output\n\n\u003cp\u003etext before \u003ctag-name class=\"class\" id=\"id\" name=\"value\" src=\"/link\" title=\"destination\" inline=\"\"\u003econtent\u003c/tag-name\u003e text after\u003c/p\u003e\n\u003ctag-name class=\"class\" id=\"id\" name=\"value\" src=\"/link\" title=\"destination\"\u003einline content\u003c/tag-name\u003e\n\u003ctag-name class=\"class\" id=\"id\" name=\"value\" src=\"/link\" title=\"destination\"\u003e\n\u003cp\u003econtent\u003c/p\u003e\n\u003c/tag-name\u003e\n\u003canother-tag\u003e\ncontent\n:::\n\u003c/another-tag\u003e\n\n*/\n```\n\nMore examples can be found in `test.js`.\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2020, lookas","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhilookas%2Fmarkdown-it-directive-webcomponents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhilookas%2Fmarkdown-it-directive-webcomponents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhilookas%2Fmarkdown-it-directive-webcomponents/lists"}