mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-14 01:27:35 +02:00
refactor: enable a few TS flags (#6852)
* refactor: enable a few TS flags * refactor * revert to working version * fix * better * change
This commit is contained in:
parent
9f925a42bf
commit
4db0c620de
71 changed files with 210 additions and 174 deletions
|
@ -48,12 +48,13 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
|
|||
let lastCodeFence = '';
|
||||
const lines = fileString.split('\n').map((line) => {
|
||||
if (line.trim().startsWith('```')) {
|
||||
const codeFence = line.trim().match(/^`+/)![0]!;
|
||||
if (!fencedBlock) {
|
||||
fencedBlock = true;
|
||||
[lastCodeFence] = line.trim().match(/^`+/)!;
|
||||
lastCodeFence = codeFence;
|
||||
// If we are in a ````-fenced block, all ``` would be plain text instead
|
||||
// of fences
|
||||
} else if (line.trim().match(/^`+/)![0].length >= lastCodeFence.length) {
|
||||
} else if (codeFence.length >= lastCodeFence.length) {
|
||||
fencedBlock = false;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +72,7 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
|
|||
let mdMatch = mdRegex.exec(modifiedLine);
|
||||
while (mdMatch !== null) {
|
||||
// Replace it to correct html link.
|
||||
const mdLink = mdMatch.groups!.filename;
|
||||
const mdLink = mdMatch.groups!.filename!;
|
||||
|
||||
const sourcesToTry = [
|
||||
path.resolve(path.dirname(filePath), decodeURIComponent(mdLink)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue