{"id":13495350,"url":"https://github.com/antfu/markdown-it-github-alerts","last_synced_at":"2025-04-06T03:07:05.799Z","repository":{"id":210028397,"uuid":"725497064","full_name":"antfu/markdown-it-github-alerts","owner":"antfu","description":"Support GitHub-style alerts for markdown-it","archived":false,"fork":false,"pushed_at":"2024-01-21T15:41:49.000Z","size":88,"stargazers_count":133,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-02T01:03:21.748Z","etag":null,"topics":["github-flavored-markdown","markdown","markdown-it"],"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/antfu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["antfu"]}},"created_at":"2023-11-30T09:13:25.000Z","updated_at":"2024-04-20T22:50:34.000Z","dependencies_parsed_at":"2024-02-09T02:10:36.914Z","dependency_job_id":"83266101-2566-407d-8703-72013f9b777d","html_url":"https://github.com/antfu/markdown-it-github-alerts","commit_stats":null,"previous_names":["antfu/markdown-it-github-alerts"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Fmarkdown-it-github-alerts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Fmarkdown-it-github-alerts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Fmarkdown-it-github-alerts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Fmarkdown-it-github-alerts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antfu","download_url":"https://codeload.github.com/antfu/markdown-it-github-alerts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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":["github-flavored-markdown","markdown","markdown-it"],"created_at":"2024-07-31T19:01:33.831Z","updated_at":"2025-04-06T03:07:05.777Z","avatar_url":"https://github.com/antfu.png","language":"TypeScript","funding_links":["https://github.com/sponsors/antfu"],"categories":["TypeScript"],"sub_categories":[],"readme":"# markdown-it-github-alerts\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n[![JSDocs][jsdocs-src]][jsdocs-href]\n[![License][license-src]][license-href]\n\nSupport [GitHub-style alerts](https://github.com/orgs/community/discussions/16925) for [markdown-it](https://github.com/markdown-it/markdown-it).\n\n\u003e [!NOTE]\n\u003e Highlights information that users should take into account, even when skimming.\n\n\u003e [!TIP]\n\u003e Optional information to help a user be more successful.\n\n\u003e [!IMPORTANT]\n\u003e Crucial information necessary for users to succeed.\n\n\u003e [!WARNING]\n\u003e Critical content demanding immediate user attention due to potential risks.\n\n\u003e [!CAUTION]\n\u003e Negative potential consequences of an action.\n\n```\n\u003e [!NOTE]\n\u003e Highlights information that users should take into account, even when skimming.\n\n\u003e [!TIP]\n\u003e Optional information to help a user be more successful.\n\n\u003e [!IMPORTANT]\n\u003e Crucial information necessary for users to succeed.\n\n\u003e [!WARNING]\n\u003e Critical content demanding immediate user attention due to potential risks.\n\n\u003e [!CAUTION]\n\u003e Negative potential consequences of an action.\n```\n\n## Usage\n\n```bash\nnpm i markdown-it-github-alerts\n```\n\n```js\nimport MarkdownIt from 'markdown-it'\nimport MarkdownItGitHubAlerts from 'markdown-it-github-alerts'\n\nconst md = MarkdownIt()\n\nmd.use(MarkdownItGitHubAlerts, /* Options */)\n\nconst html = md.render(/* ... */)\n```\n\nFor the options available, please refer to [the jsdoc](./src/index.ts).\n\n## Functionality\n\nThis plugin transforms the following markdown:\n\n```markdown\n\u003e [!NOTE]\n\u003e Highlights information that users should take into account, even when skimming.\n```\n\nto the following HTML:\n\n```html\n\u003cdiv class=\"markdown-alert markdown-alert-note\"\u003e\n  \u003cp class=\"markdown-alert-title\" dir=\"auto\"\u003e\u003c!-- svg icon--\u003eNote\u003c/p\u003e\u003cp\u003e\n  Highlights information that users should take into account, even when skimming.\u003c/p\u003e\n\u003c/div\u003e\n```\n\nWhich is compatible with the GitHub's output.\n\n### Styling\n\nYou can write your custom styles for your alerts.\n\nWe also provide some CSS extracted from GitHub's styles for you to use.\n\n```js\nimport 'markdown-it-github-alerts/styles/github-colors-light.css'\nimport 'markdown-it-github-alerts/styles/github-colors-dark-media.css'\nimport 'markdown-it-github-alerts/styles/github-base.css'\n```\n\nYou might change `github-colors-dark-media.css` to `github-colors-dark-class.css` if you are using class-based (`.dark`) dark mode.\n\nRefer to the [source code](./styles) for more details.\n\n### Customization\n\nIn order to also support [Obsidian callouts syntax](https://help.obsidian.md/Editing+and+formatting/Callouts) it is possible to allow any type of markers with the following setting:\n\n```js\nmd.use(MarkdownItGitHubAlerts, {\n  markers: '*'\n})\n```\nAlternative titles are also supported, by appending it to the marker like this:\n\n```markdown\n\u003e [!note] Nota bene\n\u003e The custom title will replace the regular title.\n```\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg\"\u003e\n    \u003cimg src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## License\n\n[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/markdown-it-github-alerts?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[npm-version-href]: https://npmjs.com/package/markdown-it-github-alerts\n[npm-downloads-src]: https://img.shields.io/npm/dm/markdown-it-github-alerts?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[npm-downloads-href]: https://npmjs.com/package/markdown-it-github-alerts\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/markdown-it-github-alerts?style=flat\u0026colorA=080f12\u0026colorB=1fa669\u0026label=minzip\n[bundle-href]: https://bundlephobia.com/result?p=markdown-it-github-alerts\n[license-src]: https://img.shields.io/github/license/antfu/markdown-it-github-alerts.svg?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[license-href]: https://github.com/antfu/markdown-it-github-alerts/blob/main/LICENSE\n[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[jsdocs-href]: https://www.jsdocs.io/package/markdown-it-github-alerts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantfu%2Fmarkdown-it-github-alerts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantfu%2Fmarkdown-it-github-alerts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantfu%2Fmarkdown-it-github-alerts/lists"}