\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.694904,{"description":2920,"labels":2921,"number":2922,"owner":2877,"repository":2878,"state":2906,"title":2923,"updated_at":2924,"url":2925,"score":2926},"### 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.6952044,{"description":2928,"labels":2929,"number":2930,"owner":2877,"repository":2878,"state":2906,"title":2931,"updated_at":2932,"url":2933,"score":2934},"### Describe the bug\n\nWhen navigating to a VitePress site from any other domain (e.g. this link: [https://vitepress.vuejs.org/](https://vitepress.vuejs.org/)), the VitePress router adds a duplicate entry to the browser session's history stack. This occurs because [`history.pushState()` is called via `router.go()` ](https://github.com/vuejs/vitepress/blob/3b890e81774740bb92baf9ac305c1f9fb11d3d2f/src/client/app/index.ts#L132) on the initial page load.\r\n\r\nThe effect of this depends on the browser.\r\n\r\n- In Chromium-based browsers, due to implementing [History Manipulation Intervention](https://groups.google.com/a/chromium.org/g/blink-dev/c/T8d4_BRb2xQ/m/WSdOiOFcBAAJ), the back button works as expected and the user returns to the previous page (e.g. this page).\r\n \r\n- Safari implements something similar and the back button also works as expected.\r\n \r\n- In Firefox, the user has to click the back button twice to return.\r\n \r\nIn all cases, the duplicate entry is still visible in the history stack.\n\n### Reproduction\n\n1. Visit [https://vitepress.vuejs.org/](https://vitepress.vuejs.org/) by left clicking the link.\r\n2. Right click (if Safari, long press) on the browser's back button and notice there is an extra entry.\n\n### Expected behavior\n\nThe extra entry is not added, like when visiting [https://developer.mozilla.org/en-US/](https://developer.mozilla.org/en-US/).\n\n### System Info\n\n```shell\nSystem:\r\n OS: Linux 6.1 Arch Linux\r\n CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics\r\n Memory: 23.05 GB / 30.74 GB\r\n Container: Yes\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 16.19.0 - /usr/bin/node\r\n npm: 8.19.2 - /usr/bin/npm\r\n Browsers:\r\n Chromium: 109.0.5414.74\r\n Firefox: 108.0.2\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.",[],1792,"Router adds duplicate entry to session history stack","2023-01-29T00:04:24Z","https://github.com/vuejs/vitepress/issues/1792",0.7090913,{"description":2936,"labels":2937,"number":2938,"owner":2877,"repository":2878,"state":2906,"title":2939,"updated_at":2940,"url":2941,"score":2942},"### Is your feature request related to a problem? Please describe.\n\nI have such a dynamic parameter page because its data needs to be rendered using Vue components. I cannot directly load and pass the content parameter in `[lang]-[version].paths.ts` and use `\u003C!-- @content -->` to render the page directly. Instead, I must load and pass all the data in `hocon.data.ts` and import it into the Vue component of the page. I found that this way will load all the data, even though I only need the data of the current page.\r\n\r\n\u003Cimg width=\"623\" alt=\"image\" src=\"https://github.com/vuejs/vitepress/assets/38158783/dc2eb916-ffad-4010-ab72-84f7685a867a\">\r\n\r\nhocon.data.ts\r\n```ts\r\ninterface HoconPageData {\r\n hocon: {\r\n [version: string]: {\r\n [language: string]: Struct[]\r\n }\r\n }\r\n}\r\n\r\nexport default defineLoader({\r\n watch: ['../public/api/hocon-*.json'],\r\n load(_watchedFiles) {\r\n const hoconPageData = {} as HoconPageData\r\n\r\n const hoconFiles = readHoconFiles()\r\n\r\n if (!hoconFiles.length)\r\n return hoconPageData\r\n\r\n hoconPageData.hocon = hoconFiles.reduce((acc: any, hoconFile) => {\r\n if (!acc[hoconFile.version])\r\n acc[hoconFile.version] = {}\r\n\r\n acc[hoconFile.version][hoconFile.lang] = JSON.parse(hoconFile.fileContent) as Struct[]\r\n return acc\r\n }, {})\r\n\r\n return hoconPageData\r\n },\r\n})\r\n```\r\n\r\nHoconView.vue\r\n```vue\r\n\u003Cscript setup lang=\"ts\">\r\nimport { computed, ref } from 'vue'\r\nimport { useData } from 'vitepress'\r\nimport type { Struct } from '../../utils/schema'\r\nimport { data } from '../../../hocon/hocon.data'\r\nimport HoconStruct from './HoconStruct.vue'\r\n\r\nconst { lang, params } = useData()\r\n\r\nconst version = computed(() => params.value?.version)\r\n\r\nconst rootStruct = ref(data.hocon[version.value][lang.value] as Struct)\r\n\u003C/script>\r\n\r\n\u003Ctemplate>\r\n \u003CHoconStruct :struct=\"rootStruct\" />\r\n\u003C/template>\r\n\r\n\u003Cstyle lang=\"scss\">\r\n\r\n\u003C/style>\r\n```\r\n\n\n### Describe the solution you'd like\n\nCurrently, only when rendering Markdown or HTML directly can the `content` parameter be passed to load page content as needed. I hope that when using local files as build data and needing Vue components to render pages, data can also be loaded according to page parameters as needed.\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.",[],3269,"Can local file data be loaded on demand based on the page?","2023-12-14T00:04:41Z","https://github.com/vuejs/vitepress/issues/3269",0.71505845,{"description":2944,"labels":2945,"number":2949,"owner":2877,"repository":2878,"state":2906,"title":2950,"updated_at":2951,"url":2952,"score":2953},"### Describe the bug\n\n\r\nI configured the logo as shown above and I can see my logo in dev mode,but after the build, the logo is gone,I can't find the logo.webp in the dist folder \n\n### Reproduction\n\nsee Describe the bug\n\n### Expected behavior\n\nExpect the logo file to be in the dist directory after build\n\n### System Info\n\n```Text\nSystem:\r\n OS: macOS 14.0\r\n CPU: (8) arm64 Apple M1\r\n Memory: 89.69 MB / 8.00 GB\r\n Shell: 5.9 - /bin/zsh\r\n Binaries:\r\n Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node\r\n Yarn: 1.22.19 - ~/.yarn/bin/yarn\r\n npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm\r\n pnpm: 8.7.4 - ~/.nvm/versions/node/v18.12.0/bin/pnpm\r\n bun: 1.0.0 - ~/.bun/bin/bun\r\n Browsers:\r\n Chrome: 119.0.6045.105\r\n Safari: 17.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.",[2946],{"name":2947,"color":2948},"bug: pending triage","e99695",3197,"The logo disappears after it is built","2023-11-16T00:04:40Z","https://github.com/vuejs/vitepress/issues/3197",0.7162376,{"description":2955,"labels":2956,"number":2960,"owner":2877,"repository":2878,"state":2906,"title":2961,"updated_at":2962,"url":2963,"score":2964},"### Describe the bug\r\n\r\nComponents at the start of a line/paragraph don't render their contents as Markdown despite other Markdown renders doing so.\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/vite-jgrywo?file=docs%2Findex.md\r\n\r\nLook at \"Some Markdown\" line. I expected it to render as Markdown...\r\n\r\n### Expected behavior\r\n\r\nIt should render as Markdown. When rendered by other systems at least it does. e.g. VS Code Markdown preview.\r\n\r\n### System Info\r\n\r\n```Text\r\nSystem:\r\n OS: Linux 5.0 undefined\r\n CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz\r\n Memory: 0 Bytes / 0 Bytes\r\n Shell: 1.0 - /bin/jsh\r\n Binaries:\r\n Node: 18.20.3 - /usr/local/bin/node\r\n Yarn: 1.22.19 - /usr/local/bin/yarn\r\n npm: 10.2.3 - /usr/local/bin/npm\r\n pnpm: 8.15.6 - /usr/local/bin/pnpm\r\n npmPackages:\r\n vitepress: latest => 1.2.3\r\n```\r\n\r\n\r\n### Additional context\r\n\r\nVitePress:\r\n\r\n\r\nVS Code:\r\n\r\n\r\n\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.",[2957],{"name":2958,"color":2959},"wont fix","EDEED1",4017,"Components at the start of a line/paragraph don't render their contents as Markdown","2024-07-11T04:42:20Z","https://github.com/vuejs/vitepress/issues/4017",0.719933,["Reactive",2966],{},["Set"],["ShallowReactive",2969],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fYB91W47zIGe75eliNNkkMrsdqqyU5FidgF1-SYgUz7c":-1},"/vuejs/vitepress/1413"]