\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,"Import custom component in MarkdownIt plugin","2023-01-21T14:22:46Z","https://github.com/vuejs/vitepress/issues/1349",0.70767343,{"description":2937,"labels":2938,"number":2942,"owner":2868,"repository":2869,"state":2923,"title":2943,"updated_at":2944,"url":2945,"score":2946},"### Describe the bug\r\n\r\nRunning `pnpm run build` on local VP repo on a Windows machine hangs.\r\n\r\n### Reproduction\r\n\r\nRun `pnpm run build` on a Windows machine\r\n\r\n### Expected behavior\r\n\r\nShouldn't hang\r\n\r\n### System Info\r\n\r\n```Text\r\nSystem:\r\n OS: Windows 10 10.0.19045\r\n CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H\r\n Memory: 34.88 GB / 63.71 GB\r\n Binaries:\r\n Node: 22.6.0 - C:\\Program Files\\nodejs\\node.EXE\r\n npm: 10.8.2 - C:\\Program Files\\nodejs\\npm.CMD\r\n pnpm: 9.12.3 - C:\\Program Files\\nodejs\\pnpm.CMD\r\n Browsers:\r\n Edge: Chromium (127.0.2651.74)\r\n Internet Explorer: 11.0.19041.4355\r\n```\r\n\r\n\r\n### Additional context\r\n\r\nUsing `fast-glob` just works.\r\n\r\nWe can fix `tinyglobby` using `cwd` and removing absolute path for the workers.\r\n\r\n### Validations\r\n\r\n- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).\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] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.",[2939],{"name":2940,"color":2941},"upstream","BF29ED",4357,"`tinyglobby` hangs when build script or running local dev using Windows","2024-11-20T04:44:08Z","https://github.com/vuejs/vitepress/issues/4357",0.71186024,{"description":2948,"labels":2949,"number":2950,"owner":2868,"repository":2869,"state":2923,"title":2951,"updated_at":2952,"url":2953,"score":2954},"### Is your feature request related to a problem? Please describe.\n\nsome function in `frontmatter.title`, like below:\r\n\r\n```markdown\r\n---\r\nlayoutClass: a-home-layout\r\ntitle: ${{ getWishNameStr(GameName.ZZZ) }}时间轴\r\noutline: false\r\naside: false\r\nsidebar: false\r\ndoc: false\r\nfooter: false\r\n---\r\n```\r\n\r\n\u003Cimg width=\"532\" alt=\"123\" src=\"https://github.com/vuejs/vitepress/assets/34206897/6fd4f405-dddb-46d1-a164-7dee1aaa476f\">\r\n\n\n### Describe the solution you'd like\n\nThe page title should be the result of the calculation. In this case it should be: `调频时间轴 | Augus Game`\n\n### Describe alternatives you've considered\n\n_No response_\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.dev).\n- [X] Read the [Contributing Guidelines](https://github.com/vuejs/vitepress/blob/main/.github/contributing.md).\n- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.",[],4025,"What if I use the function in frontmatter?","2024-07-15T04:43:22Z","https://github.com/vuejs/vitepress/issues/4025",0.7194188,{"description":2956,"labels":2957,"number":2961,"owner":2868,"repository":2869,"state":2923,"title":2962,"updated_at":2963,"url":2964,"score":2965},"### Describe the bug\n\nnode:v16.13.2\r\nvitepress: v1.0.0-rc.4\r\nvant: ~3.4.9\r\nvite ^4.4.9\r\n执行`vitepress build docs`报以下错误\r\n\r\n\n\n### Reproduction\n\n// .vitepress config.ts\r\nimport { defineConfig } from 'vitepress'\r\nimport { mdPlugin } from './config/plugins'\r\nimport sidebars from \"./sidebar\"\r\n\r\nexport default defineConfig({\r\n title: \"chuxin-ui-mobile\",\r\n // description: \"A VitePress Site\",\r\n ignoreDeadLinks: true,\r\n base: \"/cx-mobile-ui-docs/\",\r\n head: [\r\n [\r\n \"link\",\r\n { rel: \"icon\", href: \"/images/logo.png\" }\r\n ]\r\n ],\r\n themeConfig: {\r\n logo: \"/images/logo.png\",\r\n nav: [\r\n { text: '首页', link: '/' },\r\n { text: '组件', link: '/components/install', activeMatch: '/components/' },\r\n { text: '指南', link: '/development/directoryIntroduction' }\r\n ],\r\n sidebar: {\r\n \"/\": sidebars\r\n },\r\n socialLinks: [\r\n { icon: 'github', link: 'https://github.com/vuejs/vitepress' }\r\n ]\r\n },\r\n markdown: {\r\n headers: {\r\n level: [0, 0],\r\n },\r\n theme: { light: 'github-light', dark: 'github-dark' },\r\n config: (md) => mdPlugin(md),\r\n }\r\n})\r\n\n\n### Expected behavior\n\n`vitepress build docs` 可以build成功\n\n### System Info\n\n```sh\n无\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],{"name":2959,"color":2960},"need more info","bdbefc",2800,"Vitepress build vant error","2023-08-23T07:56:40Z","https://github.com/vuejs/vitepress/issues/2800",0.7216054,["Reactive",2967],{},["Set"],["ShallowReactive",2970],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$f3zbOm9Sh2G9DhBimtI8hWYyPu5NG7up2LdKEdMlPyl4":-1},"/vuejs/vitepress/2592"]