mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2024-12-08 00:45:32 +01:00
chore: better Prettier config for easier reviews
This commit is contained in:
parent
b0c27b3c3e
commit
9cf3168e66
8
.github/ISSUE_TEMPLATE/BUG.md
vendored
8
.github/ISSUE_TEMPLATE/BUG.md
vendored
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
name: '🐛 Bug Report'
|
name: "🐛 Bug Report"
|
||||||
about: 'Report an unexpected problem or unintended behavior.'
|
about: "Report an unexpected problem or unintended behavior."
|
||||||
title: '[Bug]'
|
title: "[Bug]"
|
||||||
labels: 'bug'
|
labels: "bug"
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
8
.github/ISSUE_TEMPLATE/DOCUMENTATION.md
vendored
8
.github/ISSUE_TEMPLATE/DOCUMENTATION.md
vendored
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
name: '📜 Documentation'
|
name: "📜 Documentation"
|
||||||
about: 'Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).'
|
about: "Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...)."
|
||||||
title: '[Documentation]'
|
title: "[Documentation]"
|
||||||
labels: 'documentation'
|
labels: "documentation"
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- Please make sure your issue has not already been fixed. -->
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
8
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
8
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
name: '✨ Feature Request'
|
name: "✨ Feature Request"
|
||||||
about: 'Suggest a new feature idea.'
|
about: "Suggest a new feature idea."
|
||||||
title: '[Feature]'
|
title: "[Feature]"
|
||||||
labels: 'feature request'
|
labels: "feature request"
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- Please make sure your issue has not already been fixed. -->
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
8
.github/ISSUE_TEMPLATE/IMPROVEMENT.md
vendored
8
.github/ISSUE_TEMPLATE/IMPROVEMENT.md
vendored
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
name: '🔧 Improvement'
|
name: "🔧 Improvement"
|
||||||
about: 'Improve structure/format/performance/refactor/tests of the code.'
|
about: "Improve structure/format/performance/refactor/tests of the code."
|
||||||
title: '[Improvement]'
|
title: "[Improvement]"
|
||||||
labels: 'improvement'
|
labels: "improvement"
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- Please make sure your issue has not already been fixed. -->
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
name: '🙋 Question'
|
name: "🙋 Question"
|
||||||
about: 'Further information is requested.'
|
about: "Further information is requested."
|
||||||
title: '[Question]'
|
title: "[Question]"
|
||||||
labels: 'question'
|
labels: "question"
|
||||||
---
|
---
|
||||||
|
|
||||||
### Question
|
### Question
|
||||||
|
26
.github/workflows/lint.yml
vendored
26
.github/workflows/lint.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: 'Lint'
|
name: "Lint"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -8,21 +8,21 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v3.5.2'
|
- uses: "actions/checkout@v3.5.2"
|
||||||
|
|
||||||
- name: 'Setup Node.js'
|
- name: "Setup Node.js"
|
||||||
uses: 'actions/setup-node@v3.6.0'
|
uses: "actions/setup-node@v3.6.0"
|
||||||
with:
|
with:
|
||||||
node-version: 'lts/*'
|
node-version: "lts/*"
|
||||||
cache: 'npm'
|
cache: "npm"
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: "Install dependencies"
|
||||||
run: 'npm clean-install'
|
run: "npm clean-install"
|
||||||
|
|
||||||
- run: 'npm run lint:commit -- --to "${{ github.sha }}"'
|
- run: 'npm run lint:commit -- --to "${{ github.sha }}"'
|
||||||
- run: 'npm run lint:editorconfig'
|
- run: "npm run lint:editorconfig"
|
||||||
- run: 'npm run lint:markdown'
|
- run: "npm run lint:markdown"
|
||||||
- run: 'npm run lint:eslint'
|
- run: "npm run lint:eslint"
|
||||||
- run: 'npm run lint:prettier'
|
- run: "npm run lint:prettier"
|
||||||
|
34
.github/workflows/release.yml
vendored
34
.github/workflows/release.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: 'Release'
|
name: "Release"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -6,32 +6,32 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: "ubuntu-latest"
|
||||||
permissions:
|
permissions:
|
||||||
contents: 'write'
|
contents: "write"
|
||||||
issues: 'write'
|
issues: "write"
|
||||||
pull-requests: 'write'
|
pull-requests: "write"
|
||||||
id-token: 'write'
|
id-token: "write"
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v3.5.2'
|
- uses: "actions/checkout@v3.5.2"
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: 'Setup Node.js'
|
- name: "Setup Node.js"
|
||||||
uses: 'actions/setup-node@v3.6.0'
|
uses: "actions/setup-node@v3.6.0"
|
||||||
with:
|
with:
|
||||||
node-version: 'lts/*'
|
node-version: "lts/*"
|
||||||
cache: 'npm'
|
cache: "npm"
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: "Install dependencies"
|
||||||
run: 'npm clean-install'
|
run: "npm clean-install"
|
||||||
|
|
||||||
- name: 'Verify the integrity of provenance attestations and registry signatures for installed dependencies'
|
- name: "Verify the integrity of provenance attestations and registry signatures for installed dependencies"
|
||||||
run: 'npm audit signatures'
|
run: "npm audit signatures"
|
||||||
|
|
||||||
- name: 'Release'
|
- name: "Release"
|
||||||
run: 'npm run release'
|
run: "npm run release"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: 'Test'
|
name: "Test"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -8,18 +8,18 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v3.5.2'
|
- uses: "actions/checkout@v3.5.2"
|
||||||
|
|
||||||
- name: 'Setup Node.js'
|
- name: "Setup Node.js"
|
||||||
uses: 'actions/setup-node@v3.6.0'
|
uses: "actions/setup-node@v3.6.0"
|
||||||
with:
|
with:
|
||||||
node-version: 'lts/*'
|
node-version: "lts/*"
|
||||||
cache: 'npm'
|
cache: "npm"
|
||||||
|
|
||||||
- name: 'Install dependencies'
|
- name: "Install dependencies"
|
||||||
run: 'npm clean-install'
|
run: "npm clean-install"
|
||||||
|
|
||||||
- name: 'Test'
|
- name: "Test"
|
||||||
run: 'npm run test'
|
run: "npm run test"
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
{
|
{
|
||||||
"singleQuote": true,
|
"semi": false
|
||||||
"jsxSingleQuote": true,
|
|
||||||
"semi": false,
|
|
||||||
"trailingComma": "none"
|
|
||||||
}
|
}
|
||||||
|
38
src/index.js
38
src/index.js
@ -1,39 +1,39 @@
|
|||||||
'use strict'
|
"use strict"
|
||||||
|
|
||||||
const { pathToFileURL } = require('node:url')
|
const { pathToFileURL } = require("node:url")
|
||||||
const fs = require('node:fs')
|
const fs = require("node:fs")
|
||||||
|
|
||||||
const {
|
const {
|
||||||
filterTokens,
|
filterTokens,
|
||||||
addError,
|
addError,
|
||||||
convertHeadingToHTMLFragment,
|
convertHeadingToHTMLFragment,
|
||||||
getMarkdownHeadings
|
getMarkdownHeadings,
|
||||||
} = require('./utils.js')
|
} = require("./utils.js")
|
||||||
|
|
||||||
const customRule = {
|
const customRule = {
|
||||||
names: ['relative-links'],
|
names: ["relative-links"],
|
||||||
description: 'Relative links should be valid',
|
description: "Relative links should be valid",
|
||||||
tags: ['links'],
|
tags: ["links"],
|
||||||
function: (params, onError) => {
|
function: (params, onError) => {
|
||||||
filterTokens(params, 'inline', (token) => {
|
filterTokens(params, "inline", (token) => {
|
||||||
for (const child of token.children) {
|
for (const child of token.children) {
|
||||||
const { lineNumber, type, attrs } = child
|
const { lineNumber, type, attrs } = child
|
||||||
|
|
||||||
/** @type {string | null} */
|
/** @type {string | null} */
|
||||||
let hrefSrc = null
|
let hrefSrc = null
|
||||||
|
|
||||||
if (type === 'link_open') {
|
if (type === "link_open") {
|
||||||
for (const attr of attrs) {
|
for (const attr of attrs) {
|
||||||
if (attr[0] === 'href') {
|
if (attr[0] === "href") {
|
||||||
hrefSrc = attr[1]
|
hrefSrc = attr[1]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'image') {
|
if (type === "image") {
|
||||||
for (const attr of attrs) {
|
for (const attr of attrs) {
|
||||||
if (attr[0] === 'src') {
|
if (attr[0] === "src") {
|
||||||
hrefSrc = attr[1]
|
hrefSrc = attr[1]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ const customRule = {
|
|||||||
if (hrefSrc != null) {
|
if (hrefSrc != null) {
|
||||||
const url = new URL(hrefSrc, pathToFileURL(params.name))
|
const url = new URL(hrefSrc, pathToFileURL(params.name))
|
||||||
const isRelative =
|
const isRelative =
|
||||||
url.protocol === 'file:' && !hrefSrc.startsWith('/')
|
url.protocol === "file:" && !hrefSrc.startsWith("/")
|
||||||
if (isRelative) {
|
if (isRelative) {
|
||||||
const detail = `Link "${hrefSrc}"`
|
const detail = `Link "${hrefSrc}"`
|
||||||
|
|
||||||
@ -51,13 +51,13 @@ const customRule = {
|
|||||||
addError(
|
addError(
|
||||||
onError,
|
onError,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
`${detail} should exist in the file system`
|
`${detail} should exist in the file system`,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'link_open' && url.hash !== '') {
|
if (type === "link_open" && url.hash !== "") {
|
||||||
const fileContent = fs.readFileSync(url, { encoding: 'utf8' })
|
const fileContent = fs.readFileSync(url, { encoding: "utf8" })
|
||||||
const headings = getMarkdownHeadings(fileContent)
|
const headings = getMarkdownHeadings(fileContent)
|
||||||
|
|
||||||
/** @type {Map<string, number>} */
|
/** @type {Map<string, number>} */
|
||||||
@ -77,7 +77,7 @@ const customRule = {
|
|||||||
addError(
|
addError(
|
||||||
onError,
|
onError,
|
||||||
lineNumber,
|
lineNumber,
|
||||||
`${detail} should have a valid fragment`
|
`${detail} should have a valid fragment`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ const customRule = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = customRule
|
module.exports = customRule
|
||||||
|
22
src/utils.js
22
src/utils.js
@ -1,4 +1,4 @@
|
|||||||
const MarkdownIt = require('markdown-it')
|
const MarkdownIt = require("markdown-it")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the provided function for each matching token.
|
* Calls the provided function for each matching token.
|
||||||
@ -33,7 +33,7 @@ const addError = (onError, lineNumber, detail, context, range, fixInfo) => {
|
|||||||
detail,
|
detail,
|
||||||
context,
|
context,
|
||||||
range,
|
range,
|
||||||
fixInfo
|
fixInfo,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ const addError = (onError, lineNumber, detail, context, range, fixInfo) => {
|
|||||||
*/
|
*/
|
||||||
const convertHeadingToHTMLFragment = (inlineText) => {
|
const convertHeadingToHTMLFragment = (inlineText) => {
|
||||||
return (
|
return (
|
||||||
'#' +
|
"#" +
|
||||||
encodeURIComponent(
|
encodeURIComponent(
|
||||||
inlineText
|
inlineText
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@ -56,15 +56,15 @@ const convertHeadingToHTMLFragment = (inlineText) => {
|
|||||||
// https://ruby-doc.org/core-3.0.2/Regexp.html
|
// https://ruby-doc.org/core-3.0.2/Regexp.html
|
||||||
.replace(
|
.replace(
|
||||||
/[^\p{Letter}\p{Mark}\p{Number}\p{Connector_Punctuation}\- ]/gu,
|
/[^\p{Letter}\p{Mark}\p{Number}\p{Connector_Punctuation}\- ]/gu,
|
||||||
''
|
"",
|
||||||
)
|
)
|
||||||
.replace(/ /gu, '-')
|
.replace(/ /gu, "-"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const headingTags = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
|
const headingTags = new Set(["h1", "h2", "h3", "h4", "h5", "h6"])
|
||||||
const ignoredTokens = new Set(['heading_open', 'heading_close'])
|
const ignoredTokens = new Set(["heading_open", "heading_close"])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the headings from a Markdown string.
|
* Gets the headings from a Markdown string.
|
||||||
@ -83,9 +83,9 @@ const getMarkdownHeadings = (content) => {
|
|||||||
|
|
||||||
for (const token of tokens) {
|
for (const token of tokens) {
|
||||||
if (headingTags.has(token.tag)) {
|
if (headingTags.has(token.tag)) {
|
||||||
if (token.type === 'heading_open') {
|
if (token.type === "heading_open") {
|
||||||
headingToken = token.markup
|
headingToken = token.markup
|
||||||
} else if (token.type === 'heading_close') {
|
} else if (token.type === "heading_close") {
|
||||||
headingToken = null
|
headingToken = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ const getMarkdownHeadings = (content) => {
|
|||||||
.map((token) => {
|
.map((token) => {
|
||||||
return token.content
|
return token.content
|
||||||
})
|
})
|
||||||
.join('')}`
|
.join("")}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,5 +114,5 @@ module.exports = {
|
|||||||
filterTokens,
|
filterTokens,
|
||||||
addError,
|
addError,
|
||||||
convertHeadingToHTMLFragment,
|
convertHeadingToHTMLFragment,
|
||||||
getMarkdownHeadings
|
getMarkdownHeadings,
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,46 @@
|
|||||||
const test = require('node:test')
|
const test = require("node:test")
|
||||||
const assert = require('node:assert/strict')
|
const assert = require("node:assert/strict")
|
||||||
|
|
||||||
const { markdownlint } = require('markdownlint').promises
|
const { markdownlint } = require("markdownlint").promises
|
||||||
|
|
||||||
const relativeLinks = require('../src/index.js')
|
const relativeLinks = require("../src/index.js")
|
||||||
|
|
||||||
test('ensure the rule validate correctly', async () => {
|
test("ensure the rule validate correctly", async () => {
|
||||||
const lintResults = await markdownlint({
|
const lintResults = await markdownlint({
|
||||||
files: ['test/fixtures/Valid.md', 'test/fixtures/Invalid.md'],
|
files: ["test/fixtures/Valid.md", "test/fixtures/Invalid.md"],
|
||||||
config: {
|
config: {
|
||||||
default: false,
|
default: false,
|
||||||
'relative-links': true
|
"relative-links": true,
|
||||||
},
|
},
|
||||||
customRules: [relativeLinks]
|
customRules: [relativeLinks],
|
||||||
})
|
})
|
||||||
assert.equal(lintResults['test/fixtures/Valid.md'].length, 0)
|
assert.equal(lintResults["test/fixtures/Valid.md"].length, 0)
|
||||||
assert.equal(lintResults['test/fixtures/Invalid.md'].length, 3)
|
assert.equal(lintResults["test/fixtures/Invalid.md"].length, 3)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lintResults['test/fixtures/Invalid.md'][0]?.ruleDescription,
|
lintResults["test/fixtures/Invalid.md"][0]?.ruleDescription,
|
||||||
'Relative links should be valid'
|
"Relative links should be valid",
|
||||||
)
|
)
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lintResults['test/fixtures/Invalid.md'][0]?.errorDetail,
|
lintResults["test/fixtures/Invalid.md"][0]?.errorDetail,
|
||||||
'Link "./basic.test.js" should exist in the file system'
|
'Link "./basic.test.js" should exist in the file system',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lintResults['test/fixtures/Invalid.md'][1]?.ruleDescription,
|
lintResults["test/fixtures/Invalid.md"][1]?.ruleDescription,
|
||||||
'Relative links should be valid'
|
"Relative links should be valid",
|
||||||
)
|
)
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lintResults['test/fixtures/Invalid.md'][1]?.errorDetail,
|
lintResults["test/fixtures/Invalid.md"][1]?.errorDetail,
|
||||||
'Link "../image.png" should exist in the file system'
|
'Link "../image.png" should exist in the file system',
|
||||||
)
|
)
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lintResults['test/fixtures/Invalid.md'][2]?.ruleDescription,
|
lintResults["test/fixtures/Invalid.md"][2]?.ruleDescription,
|
||||||
'Relative links should be valid'
|
"Relative links should be valid",
|
||||||
)
|
)
|
||||||
assert.equal(
|
assert.equal(
|
||||||
lintResults['test/fixtures/Invalid.md'][2]?.errorDetail,
|
lintResults["test/fixtures/Invalid.md"][2]?.errorDetail,
|
||||||
'Link "./Valid.md#not-existing-heading" should have a valid fragment'
|
'Link "./Valid.md#not-existing-heading" should have a valid fragment',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
const test = require('node:test')
|
const test = require("node:test")
|
||||||
const assert = require('node:assert/strict')
|
const assert = require("node:assert/strict")
|
||||||
|
|
||||||
const {
|
const {
|
||||||
convertHeadingToHTMLFragment,
|
convertHeadingToHTMLFragment,
|
||||||
getMarkdownHeadings
|
getMarkdownHeadings,
|
||||||
} = require('../src/utils.js')
|
} = require("../src/utils.js")
|
||||||
|
|
||||||
test('utils', async (t) => {
|
test("utils", async (t) => {
|
||||||
await t.test('convertHeadingToHTMLFragment', async () => {
|
await t.test("convertHeadingToHTMLFragment", async () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
convertHeadingToHTMLFragment('Valid Fragments'),
|
convertHeadingToHTMLFragment("Valid Fragments"),
|
||||||
'#valid-fragments'
|
"#valid-fragments",
|
||||||
)
|
)
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
convertHeadingToHTMLFragment('Valid Heading With Underscores _'),
|
convertHeadingToHTMLFragment("Valid Heading With Underscores _"),
|
||||||
'#valid-heading-with-underscores-_'
|
"#valid-heading-with-underscores-_",
|
||||||
)
|
)
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
convertHeadingToHTMLFragment(
|
convertHeadingToHTMLFragment(
|
||||||
`Valid Heading With Quotes ' And Double Quotes "`
|
`Valid Heading With Quotes ' And Double Quotes "`,
|
||||||
),
|
),
|
||||||
'#valid-heading-with-quotes--and-double-quotes-'
|
"#valid-heading-with-quotes--and-double-quotes-",
|
||||||
)
|
)
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
convertHeadingToHTMLFragment('🚀 Valid Heading With Emoji'),
|
convertHeadingToHTMLFragment("🚀 Valid Heading With Emoji"),
|
||||||
'#-valid-heading-with-emoji'
|
"#-valid-heading-with-emoji",
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await t.test('getMarkdownHeadings', async () => {
|
await t.test("getMarkdownHeadings", async () => {
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
getMarkdownHeadings('# Hello\n\n## World\n\n## Hello, world!\n'),
|
getMarkdownHeadings("# Hello\n\n## World\n\n## Hello, world!\n"),
|
||||||
['Hello', 'World', 'Hello, world!']
|
["Hello", "World", "Hello, world!"],
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user