{"id":25475211,"url":"https://github.com/chiaweilee/umi-plugin-md","last_synced_at":"2025-11-05T18:30:29.997Z","repository":{"id":47181710,"uuid":"194485210","full_name":"chiaweilee/umi-plugin-md","owner":"chiaweilee","description":"🍚 Markdown(*.md) component plugin for umi.","archived":false,"fork":false,"pushed_at":"2021-09-10T15:15:33.000Z","size":770,"stargazers_count":16,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-21T11:48:20.484Z","etag":null,"topics":["component","markdown","umi","umi-plugin"],"latest_commit_sha":null,"homepage":"https://chiaweilee.github.io/umi-plugin-md/","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/chiaweilee.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":"2019-06-30T06:55:24.000Z","updated_at":"2021-09-09T14:47:30.000Z","dependencies_parsed_at":"2022-08-19T03:21:15.868Z","dependency_job_id":null,"html_url":"https://github.com/chiaweilee/umi-plugin-md","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiaweilee%2Fumi-plugin-md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiaweilee%2Fumi-plugin-md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiaweilee%2Fumi-plugin-md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiaweilee%2Fumi-plugin-md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiaweilee","download_url":"https://codeload.github.com/chiaweilee/umi-plugin-md/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239467461,"owners_count":19643605,"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":["component","markdown","umi","umi-plugin"],"created_at":"2025-02-18T11:54:32.210Z","updated_at":"2025-11-05T18:30:29.964Z","avatar_url":"https://github.com/chiaweilee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [umi-plugin-md](#) \u0026middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/chiaweilee/umi-plugin-md/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/umi-plugin-md.svg?style=flat)](https://www.npmjs.com/package/umi-plugin-md) [![npm downloads](https://img.shields.io/npm/dm/umi-plugin-md.svg)](https://npmcharts.com/compare/umi-plugin-md?minimal=true) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#)\n\nMarkdown(\\*.md) component plugin for umi. \n\n*Create your website with umi and markdown only. Convenient and powerful for blog, documentation site and GitBook.*\n\n* **Convert markdown into component:** loaded by `markdown-it` and translate into React component.\n* **Auto routes create:** auto create markdown routes from dir.\n* **Auto anchor:** auto create anchor for `h1`, `h2` and `h3`.\n* **XSS protect:** by [xss](https://www.npmjs.com/package/xss).\n* **Support:** umi@2.x only\n\n![Example](https://raw.githubusercontent.com/chiaweilee/umi-plugin-md/master/Screenshot%202019-07-08%20at%2021.15.41.png)\n\n## Installation\n\n```\nnpm install umi-plugin-md\n```\n\n## Demo\n\nhttps://chiaweilee.github.io/umi-plugin-md/\n\n## Usage\n\n```js\n// .umirc.js\nexport default {\n  plugins: ['umi-plugin-md'],\n};\n```\n\n## Options\n\noption | intro | type |  default  \n-|-|-|-\nanchor | Auto Anchor `^0.2.0` | string[], falsy to disable | ['h1', 'h2', 'h3'] |\nwrapper | HTMLElementTagName | string | section |\nclassName | React className | string | |\nstyle | React style | object | |\nhtml | markdown-it option | boolean | true |\nxhtmlOut | markdown-it option | boolean | true |\nbreaks | markdown-it option | boolean | true |\nlinkify | markdown-it option | boolean | true |\ntypographer | markdown-it option | boolean | true |\nhighlight | markdown-it option | function | highlight.js |\nrender | wrapper render | (rawHtml: string) =\u003e string; | see `src/render.ts` |\n\n**tips**: `route of markdown will have higher priority, so route might be covered.`\n\ne.g, `index.md` will cover `index.jsx`.\n\n## Anchor\n\n![Example](https://raw.githubusercontent.com/chiaweilee/umi-plugin-md/master/Screenshot%202019-07-16%20at%2022.56.20.png)\n\n#### Get anchor id?\n\n```js\nimport { slug } from 'umi-plugin-md';\n\nvar text = $('h2').text();\nvar id = slug(text);\n```\n\nOr copy `umi-plugin-md/lib/helpers/slug.js` to your repo.\n\n#### Anchor Stylize\n\n```css\n// global.css\n@import \"~umi-plugin-md/anchor.css\";\n```\n\nOr, write yourself.\n\ntips: we do not support `scroll to anchor on 'componentDidMount'` this moment.\n\n## Markdown Stylize\n\n[github-markdown-css](https://www.npmjs.com/package/github-markdown-css)\n\n```css\n// global.css\n@import \"~github-markdown-css/github-markdown.css\";\n@import \"~highlight.js/styles/github.css\";\n```\n\n```js\n// .umirc.js\nexport default {\n  plugins: [['umi-plugin-md', { className: 'markdown-body' }]],\n};\n```\n\n## Priority\n\n`index.md` have higher priority than `index.jsx`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiaweilee%2Fumi-plugin-md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiaweilee%2Fumi-plugin-md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiaweilee%2Fumi-plugin-md/lists"}