\r\n\u003C/div>\r\n`\r\n\r\n// when creating a demo section, `@/` will be replaced with `srcDir`\r\nexport const demoPlugin = (md: MarkdownIt, srcDir: string) => {\r\n const parser: RuleBlock = (state, startLine, _endLine, _silent) => {\r\n /*... some code to extract the file name from the markdown ... */\r\n token.attrSet('src', resolve(filename))\r\n return true\r\n }\r\n\r\n const renderer: RenderRule = (...args) => {\r\n /* ... some code to get `src` and check that the file exists ... */\r\n \r\n const file = readFileSync(src, 'utf8')\r\n\r\n // script\r\n token.info = `ts`\r\n token.content = findSection(file, SCRIPT_START, SCRIPT_END)\r\n const script = md.renderer.rules.fence!(...args)\r\n\r\n // template\r\n token.info = `vue-html`\r\n token.content = findSection(file, TEMPLATE_START, TEMPLATE_END)\r\n const template = md.renderer.rules.fence!(...args)\r\n\r\n // component\r\n const demo = md.render(COMPONENT_SNIPPET(src))\r\n\r\n return script + template + demo\r\n }\r\n\r\n md.renderer.rules.demo = renderer\r\n md.block.ruler.before(md.block.ruler.getRules('')[0].name, 'demo', parser)\r\n}\r\n\r\n// returns everything between the first match of `start` and the subsequent first match for `end`\r\nfunction findSection(content: string, start: RegExp, end: RegExp): string {\r\n //...\r\n}\r\n``` \r\n\r\nSo the markdown rendered used to take the line `const demo = md.render(COMPONENT_SNIPPET(src))` and automagically put the `import` statement where it needs to be and happily render the component. However, since updating to `1.0.0-alpha.11` this no longer works. In fact if I manually write out the import statement in the markdown file, everything works - so something is wrong with the way my plugin is handling the import.\r\n\r\nI looked into the way [plugin-sfc](https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc) works and it looks like there was a change from `0.10.0` to `0.11.0` in the way script SFC blocks are handled.\r\n\r\nI tried to copy the way the changed code works in my plugin, but I have not managed to get it working:\r\n\r\n```ts\r\n const block = `\u003Cscript setup lang=\"ts\"> import DemoComponent from \"${src}\"; \u003C/script>`\r\n sfcBlocks.scriptSetup = block\r\n sfcBlocks.scripts.push(block)\r\n\r\n token.content = `\u003Cdiv class=\"vp-raw\"> \u003Cdemo-component/> \u003C/div>`\r\n const demo = md.renderer.rules.html_block!(...args)\r\n```\r\n\r\nDoes anyone know how this can be done? How can my plugin tell VitePress that it needs to import the demo component for this page?\r\n",[],1349,"closed","Import custom component in MarkdownIt plugin","2023-01-21T14:22:46Z","https://github.com/vuejs/vitepress/issues/1349",0.6686477,{"description":2922,"labels":2923,"number":2927,"owner":2877,"repository":2878,"state":2916,"title":2928,"updated_at":2929,"url":2930,"score":2931},"### Is your feature request related to a problem? Please describe.\r\n\r\n例如:\r\n- 当我部署在 github 渲染显示如下内容\r\n\r\n ```md\r\n git clone https://github.com/username/xxxx.git\r\n ```\r\n\r\n- 当我部署在 gitee 渲染显示如下内容\r\n\r\n ```md\r\n git clone https://gitee.com/username/xxxx.git\r\n ```\r\n\r\n\r\n\r\n### Describe the solution you'd like\r\n\r\nSupport:\r\n\r\n\u003Cpre>\r\n ```md {render=window.location.href.start('https://github.com')}\r\n git clone https://github.com/username/xxxx.git\r\n ```\r\n\u003C/pre>\r\n\r\n\u003Cpre>\r\n ```md {render=window.location.href.start('https://gitee.com')}\r\n git clone https://gitee.com/username/xxxx.git\r\n ```\r\n\u003C/pre>\r\n\r\n### Describe alternatives you've considered\r\n\r\n_No response_\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\r\n- [X] Read the [docs](https://vitepress.dev).\r\n- [X] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/main/.github/contributing.md).\r\n- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.",[2924],{"name":2925,"color":2926},"wont fix","EDEED1",3829,"支持 Markdown 动态渲染","2024-05-03T04:42:02Z","https://github.com/vuejs/vitepress/issues/3829",0.6763811,{"description":2933,"labels":2934,"number":2938,"owner":2877,"repository":2878,"state":2916,"title":2939,"updated_at":2940,"url":2941,"score":2942},"### Describe the bug\n\nJust follow the document, add workflow and push docs to repo.\r\nVitepress works well locally with `pnpm docs:dev`, but after deploy to github pages, it losts the index.md content, or in another word, useful part of them, as you can see, it does have the notes part\r\n[](https://imgse.com/i/xniiA1)\r\nI have checked the local build file, it contains the correct content.\r\nSince i used the exact workflow and already set the `base` config, i can't figure out why it leads to this.\n\n### Reproduction\n\nclone this repo [Youbei](https://github.com/Hellager/Youbei) and deploy its docs to the github pages\n\n### Expected behavior\n\nGithub pages show normally like docs in local\r\n[](https://imgse.com/i/xniuBd)\n\n### System Info\n\n```shell\nSystem:\r\n OS: Windows 10 10.0.19044\r\n CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz\r\n Memory: 2.11 GB / 7.78 GB\r\n Binaries:\r\n Node: 16.13.1 - C:\\Program Files\\nodejs\\node.EXE\r\n Yarn: 1.22.19 - ~\\AppData\\Local\\pnpm\\yarn.CMD\r\n npm: 8.1.2 - C:\\Program Files\\nodejs\\npm.CMD\r\n Browsers:\r\n Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.50)\r\n Internet Explorer: 11.0.19041.1566\r\n npmPackages:\r\n vitepress: 1.0.0-alpha.17 => 1.0.0-alpha.17\n```\n\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.vuejs.org).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2935],{"name":2936,"color":2937},"bug: pending triage","e99695",1413,"Deploying to github pages and lost both router and content ","2023-01-21T14:25:20Z","https://github.com/vuejs/vitepress/issues/1413",0.70531595,{"description":2944,"labels":2945,"number":2950,"owner":2877,"repository":2878,"state":2916,"title":2951,"updated_at":2952,"url":2953,"score":2954},"### Is your feature request related to a problem? Please describe.\r\n\r\nHello,\r\n\r\nActually, I have to create a loader for each language, and then import all of them in my vue component.\r\n\r\n```ts\r\n// @ts-expect-error - vitepress types are not available\r\nimport { data as rootData } from '../../data/posts.data'\r\n// @ts-expect-error - vitepress types are not available\r\nimport { data as frData } from '../../data/fr-posts.data'\r\nimport { computed } from 'vue';\r\n\r\nconst data: Record\u003Cstring, any> = {\r\n root: rootData,\r\n fr: frData\r\n}\r\n\r\nconst { localeIndex } = useData()\r\n\r\nconst posts = computed(() => data[localeIndex.value])\r\n```\r\n\r\n### Describe the solution you'd like\r\n\r\nI would like to have to only create a single content loader and based on my locales configuration (and maybe an option) retrive all content.\r\n\r\nFor example: `posts/*.md` should get `posts/*.md` (the root) and `fr/posts/*.md` (the fr locale).\r\n\r\n### Describe alternatives you've considered\r\n\r\n_No response_\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Validations\r\n\r\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\r\n- [X] Read the [docs](https://vitepress.dev).\r\n- [X] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/main/.github/contributing.md).\r\n- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.",[2946,2949],{"name":2947,"color":2948},"has-workaround","1B4515",{"name":2871,"color":2872},4072,"Support i18n in `contentLoader`","2024-10-08T04:44:35Z","https://github.com/vuejs/vitepress/issues/4072",0.7147213,{"description":2956,"labels":2957,"number":2960,"owner":2877,"repository":2878,"state":2916,"title":2961,"updated_at":2962,"url":2963,"score":2964},"### Describe the bug\n\n`rewrite` rule doesn't work correctly when create new markdown file.\n\n### Reproduction\n\n1, Set `rewrite`\r\n\r\n```js\r\n// vitepress/config.js\r\nrewrite: [`en/:rest*`]: ':rest*'\r\n```\r\n\r\n2, Create new markdown file `docs/en/test.md`\r\n\r\n3, Expect visit file by url `/test`, but it redirect to `/en/test`.\r\n\r\n4, Restart dev server, problem resolved.\n\n### Expected behavior\n\nExpect `rewrite` rule work correctly when create new markdown file.\n\n### System Info\n\n```Text\nvitepress: 1.5.0\n```\n\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).\n- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [X] Read the [docs](https://vitepress.dev).\n- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2958,2959],{"name":2936,"color":2937},{"name":2871,"color":2872},4385,"Rewrite not work when create new markdown file","2025-03-08T04:41:55Z","https://github.com/vuejs/vitepress/issues/4385",0.71493715,{"description":2966,"labels":2967,"number":2969,"owner":2877,"repository":2878,"state":2916,"title":2970,"updated_at":2971,"url":2972,"score":2973},"### Describe the bug\n\nWe are migrating from vuepress to vitepress. Links to paths like something .md was accespted as `something/` (with slash) in vuepress 👍 . No html links were generated. Is it possible also in vitepress? To prevent creation linking to .html files. It could be tricky for us to migrate to vitepress, as links are marked as dead and `something/` is returning 404 now 👎 \n\n### Reproduction\n\nUse (link)[page/, which is linking to page.md. In vuepress linking / -> .md is working. In vitepress not...\n\n### Expected behavior\n\nThere should be option or description on how to setup.\n\n### System Info\n\n```Text\nSystem:\n OS: Linux 6.12 Pop!_OS 22.04 LTS\n CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P\n Memory: 20.71 GB / 31.05 GB\n Container: Yes\n Shell: 5.1.16 - /bin/bash\n Binaries:\n Node: 18.20.4 - ~/.nodenv/versions/18/bin/node\n Yarn: 1.22.22 - /usr/bin/yarn\n npm: 10.7.0 - ~/.nodenv/versions/18/bin/npm\n npmPackages:\n vitepress: ^1.6.3 => 1.6.3\n```\n\n### Additional context\n\n_No response_\n\n### Validations\n\n- [x] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).\n- [x] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)\n- [x] Read the [docs](https://vitepress.dev).\n- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2968],{"name":2936,"color":2937},4651,"Allow use .html and / version of path","2025-03-26T17:56:39Z","https://github.com/vuejs/vitepress/issues/4651",0.7200836,["Reactive",2975],{},["Set"],["ShallowReactive",2978],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fBn3HJMPdLpCrCTvcivqLwn19CSPtqkgImEOpXaL0ZWE":-1},"/vuejs/vitepress/4025"]