{"id":16583613,"url":"https://github.com/palmcivet/markdown-it-conditional-render","last_synced_at":"2026-04-20T01:33:41.030Z","repository":{"id":57747210,"uuid":"504517983","full_name":"palmcivet/markdown-it-conditional-render","owner":"palmcivet","description":"Plugin for creating if-else conditional blocks for markdown-it markdown parser","archived":false,"fork":false,"pushed_at":"2022-08-06T08:05:30.000Z","size":193,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-17T14:39:14.795Z","etag":null,"topics":["conditional-rendering","markdown-it","markdown-it-plugin"],"latest_commit_sha":null,"homepage":"https://palmcivet.github.io/markdown-it-conditional-render/","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/palmcivet.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":"2022-06-17T11:59:21.000Z","updated_at":"2022-08-06T07:50:05.000Z","dependencies_parsed_at":"2022-09-06T03:20:10.851Z","dependency_job_id":null,"html_url":"https://github.com/palmcivet/markdown-it-conditional-render","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/palmcivet/markdown-it-conditional-render","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmcivet%2Fmarkdown-it-conditional-render","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmcivet%2Fmarkdown-it-conditional-render/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmcivet%2Fmarkdown-it-conditional-render/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmcivet%2Fmarkdown-it-conditional-render/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palmcivet","download_url":"https://codeload.github.com/palmcivet/markdown-it-conditional-render/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmcivet%2Fmarkdown-it-conditional-render/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32029714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"ssl_error","status_checked_at":"2026-04-20T00:17:31.068Z","response_time":55,"last_error":"SSL_read: 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":["conditional-rendering","markdown-it","markdown-it-plugin"],"created_at":"2024-10-11T22:42:36.980Z","updated_at":"2026-04-20T01:33:41.005Z","avatar_url":"https://github.com/palmcivet.png","language":"TypeScript","readme":"# markdown-it-conditional-render\n\n[![build](https://github.com/palmcivet/markdown-it-conditional-render/actions/workflows/build.yml/badge.svg)](https://github.com/palmcivet/markdown-it-conditional-render/actions/workflows/build.yml)\n\nEnglish | [中文](./README.zh-CN.md)\n\nMarkdown It conditional rendering plugin, inspired by [markdown-it-condition](https://www.npmjs.com/package/markdown-it-condition), the original repository has been removed or moved, but the compiled and compressed code is still available in NPM and has been extracted from [lib/markdown-it-condition.js](./lib/markdown-it-condition.js).\n\n## ⚙️ Options\n\n- `ruleName`：*string*\n  - Default: `condition`\n  - Custom rule name\n- `ifMarker`：*string*\n  - Default: `::if`\n  - Judging from here, *if* branching condition\n- `elseIfMarker`：*string*\n  - Default: `::elseif`\n  - *else if* branching condition\n- `elseMarker`：*string*\n  - Default: `::else`\n  - *else* branching condition\n- `endIfMarker`：*string*\n  - Default: `::endif`\n  - End of judgment\n- `validate(condition: string): boolean`\n  - Preprocess the original text and verify the branching conditions in the text\n  - Default returns `true`\n- `evaluate(condition: string, value: any): boolean`\n  - Parse the actual parameters and remove the text that does not meet the conditions\n  - The default processing is as follows：\n\n\t```ts\n\tfunction evaluate(condition: string, value: any) {\n\t\tlet element = value;\n\t\tcondition.split(\".\").forEach((field) =\u003e {\n\t\t\telement = element[field];\n\t\t});\n\n\t\tif (!!element) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\t```\n\n\u003e The full usage of each parameter by default is shown in the [example](#-example)\n\n## 📚 Example\n\n```js\nconst MarkdownIt = require(\"markdown-it\")\nconst markdownItEngine = new MarkdownIt();\nconst markdownItConditionalRender = require(\"markdown-it-conditional-render\");\n\nmarkdownItEngine.use(markdownItConditionalRender);\n\nconst res = markdownItEngine.render(\n  `\n::if flag.value\n\n*This text will be shown*\n\n::else\n\n*This text won't\n\n::endif\n`,\n{\n  flag: {\n    value: true,\n  },\n});\n\nconsole.log(res);\n```\n\n## 🔧 Develop\n\n```bash\n$ git clone https://github.com/palmcivet/markdown-it-conditional-render.git\n$ cd ./markdown-it-conditional-render\n$ pnpm add\n$ pnpm run build\n```\n\n## ⚖️ License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmcivet%2Fmarkdown-it-conditional-render","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalmcivet%2Fmarkdown-it-conditional-render","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmcivet%2Fmarkdown-it-conditional-render/lists"}