fix(compat): remove use of array.at

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/1978/head
gittig11 2 years ago committed by GitHub
parent 191ac86a85
commit fd995906f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,7 +58,11 @@ export default defineConfig({
function nav() {
return [
{ text: 'Guide', link: '/guide/what-is-vitepress', activeMatch: '/guide/' },
{ text: 'Config Reference', link: '/config/introduction', activeMatch: '/config/' },
{
text: 'Config Reference',
link: '/config/introduction',
activeMatch: '/config/'
},
{
text: pkg.version,
items: [

@ -27,7 +27,8 @@ export const lineNumberPlugin = (md: MarkdownIt, enable = false) => {
const lineNumbersCode = [
...Array(
lines.length - (lines.at(-1) === `<span class="line"></span>` ? 1 : 0)
lines.length -
(lines[lines.length - 1] === `<span class="line"></span>` ? 1 : 0)
)
]
.map((_, index) => `<span class="line-number">${index + 1}</span><br>`)

@ -115,7 +115,7 @@ export const snippetPlugin = (md: MarkdownIt, srcDir: string) => {
rawTitle = ''
] = (rawPathRegexp.exec(rawPath) || []).slice(1)
const title = rawTitle || filename.split('/').at(-1) || ''
const title = rawTitle || filename.split('/').pop() || ''
state.line = startLine + 1

Loading…
Cancel
Save