Skip to content

Commit fd99590

Browse files
gittig11brc-dd
andauthored
fix(compat): remove use of array.at
Co-authored-by: Divyansh Singh <[email protected]>
1 parent 191ac86 commit fd99590

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

docs/.vitepress/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ export default defineConfig({
5858
function nav() {
5959
return [
6060
{ text: 'Guide', link: '/guide/what-is-vitepress', activeMatch: '/guide/' },
61-
{ text: 'Config Reference', link: '/config/introduction', activeMatch: '/config/' },
61+
{
62+
text: 'Config Reference',
63+
link: '/config/introduction',
64+
activeMatch: '/config/'
65+
},
6266
{
6367
text: pkg.version,
6468
items: [

src/node/markdown/plugins/lineNumbers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export const lineNumberPlugin = (md: MarkdownIt, enable = false) => {
2727

2828
const lineNumbersCode = [
2929
...Array(
30-
lines.length - (lines.at(-1) === `<span class="line"></span>` ? 1 : 0)
30+
lines.length -
31+
(lines[lines.length - 1] === `<span class="line"></span>` ? 1 : 0)
3132
)
3233
]
3334
.map((_, index) => `<span class="line-number">${index + 1}</span><br>`)

src/node/markdown/plugins/snippet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const snippetPlugin = (md: MarkdownIt, srcDir: string) => {
115115
rawTitle = ''
116116
] = (rawPathRegexp.exec(rawPath) || []).slice(1)
117117

118-
const title = rawTitle || filename.split('/').at(-1) || ''
118+
const title = rawTitle || filename.split('/').pop() || ''
119119

120120
state.line = startLine + 1
121121

0 commit comments

Comments
 (0)