fix(build): fix code groups for line numbers mode (#1700)

pull/1701/head
Divyansh Singh 2 years ago committed by GitHub
parent a684b67ec0
commit 135b797cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
.gitignore vendored

@ -1,4 +1,3 @@
/__tests__/e2e/.vitepress/cache
/coverage
/src/client/shared.ts
/src/node/shared.ts
@ -10,6 +9,7 @@
.vite_opt_cache
.vscode
dist
cache
examples-temp
node_modules
pnpm-global

@ -1,84 +0,0 @@
# Code Groups
::: code-group
```txt-vue{1}
{{ 1 + 1 }}
```
```js [app.vue]
<template>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</template>
```
<!-- kkk -->
```vue-html{3,4} [layouts/custom.vue]
<template>
<div>
Some *custom* layout
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet mi in nunc faucibus consequat.
<slot />
</div>
</template>
```
```js{1-3,5} [layouts/default.vue]
export default {
name: 'MyComponent'
// ...
}
<template>
<div>
Some *custom* layout
<slot />
</div>
</template>
```
:::
- in list
- ::: code-group
```js
printf('111')
```
```python
import torch as th
print("Hello world")
```
```
import torch as th
print("Hello world")
```
:::
```
.
├─ index.md
├─ foo
│ ├─ index.md
│ ├─ one.md
│ └─ two.md
└─ bar
├─ index.md
├─ three.md
└─ four.md
```
- ```md{1-3,5}
[Home](/) <!-- sends the user to the root index.md -->
[foo](/foo/) <!-- sends the user to index.html of directory foo -->
[foo heading](./#heading) <!-- anchors user to a heading in the foo index file -->
[bar - three](../bar/three) <!-- you can omit extention -->
[bar - three](../bar/three.md) <!-- you can append .md -->
[bar - four](../bar/four.html) <!-- or you can append .html -->
```

@ -84,7 +84,6 @@
"@vue/devtools-api": "^6.4.5",
"@vueuse/core": "^9.6.0",
"body-scroll-lock": "4.0.0-beta.0",
"nanoid": "3.3.4",
"shiki": "^0.11.1",
"vite": "^4.0.0",
"vue": "^3.2.45"
@ -139,6 +138,7 @@
"markdown-it-emoji": "^2.0.2",
"micromatch": "^4.0.5",
"minimist": "^1.2.7",
"nanoid": "^3.3.4",
"npm-run-all": "^4.1.5",
"ora": "^5.4.1",
"picocolors": "^1.0.0",

@ -59,7 +59,7 @@ importers:
markdown-it-emoji: ^2.0.2
micromatch: ^4.0.5
minimist: ^1.2.7
nanoid: 3.3.4
nanoid: ^3.3.4
npm-run-all: ^4.1.5
ora: ^5.4.1
picocolors: ^1.0.0
@ -92,7 +92,6 @@ importers:
'@vue/devtools-api': 6.4.5
'@vueuse/core': 9.6.0_vue@3.2.45
body-scroll-lock: 4.0.0-beta.0
nanoid: 3.3.4
shiki: 0.11.1
vite: 4.0.0_@types+node@18.11.13
vue: 3.2.45
@ -146,6 +145,7 @@ importers:
markdown-it-emoji: 2.0.2
micromatch: 4.0.5
minimist: 1.2.7
nanoid: 3.3.4
npm-run-all: 4.1.5
ora: 5.4.1
picocolors: 1.0.0

@ -21,7 +21,7 @@ export const lineNumberPlugin = (md: MarkdownIt) => {
const finalCode = rawCode
.replace(/<\/div>$/, `${lineNumbersWrapperCode}</div>`)
.replace(/"(language-\S*?)"/, '"$1 line-numbers-mode"')
.replace(/"(language-[^"]*?)"/, '"$1 line-numbers-mode"')
return finalCode
}

Loading…
Cancel
Save