mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-14 01:27:35 +02:00
chore: clean up ESLint config, enable a few rules (#6514)
* chore: clean up ESLint config, enable a few rules * enable max-len for comments * fix build
This commit is contained in:
parent
b8ccb869f1
commit
aa446b7a9c
167 changed files with 1157 additions and 960 deletions
|
@ -51,7 +51,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
|
|||
if (!fencedBlock) {
|
||||
fencedBlock = true;
|
||||
[lastCodeFence] = line.trim().match(/^`+/)!;
|
||||
// If we are in a ````-fenced block, all ``` would be plain text instead of fences
|
||||
// If we are in a ````-fenced block, all ``` would be plain text instead
|
||||
// of fences
|
||||
} else if (line.trim().match(/^`+/)![0].length >= lastCodeFence.length) {
|
||||
fencedBlock = false;
|
||||
}
|
||||
|
@ -62,7 +63,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
|
|||
|
||||
let modifiedLine = line;
|
||||
// Replace inline-style links or reference-style links e.g:
|
||||
// This is [Document 1](doc1.md) -> we replace this doc1.md with correct link
|
||||
// This is [Document 1](doc1.md) -> we replace this doc1.md with correct
|
||||
// ink
|
||||
// [doc1]: doc1.md -> we replace this doc1.md with correct link
|
||||
const mdRegex =
|
||||
/(?:(?:\]\()|(?:\]:\s?))(?!https?:\/\/|@site\/)([^'")\]\s>]+\.mdx?)/g;
|
||||
|
@ -86,7 +88,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
|
|||
: undefined;
|
||||
|
||||
if (permalink) {
|
||||
// MDX won't be happy if the permalink contains a space, we need to convert it to %20
|
||||
// MDX won't be happy if the permalink contains a space, we need to
|
||||
// convert it to %20
|
||||
const encodedPermalink = permalink
|
||||
.split('/')
|
||||
.map((part) => part.replace(/\s/g, '%20'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue