Replace deprecated String#substr with String#slice (#8314)
This commit is contained in:
parent
0e68c16a90
commit
c35fc169f5
17 changed files with 37 additions and 37 deletions
|
@ -97,7 +97,7 @@ function parseCodeBlock(n: Node, pc: PartCreator): Part[] {
|
|||
if (n.firstChild?.nodeName === "CODE") {
|
||||
for (const className of (n.firstChild as HTMLElement).classList) {
|
||||
if (className.startsWith("language-") && !className.startsWith("language-_")) {
|
||||
language = className.substr("language-".length);
|
||||
language = className.slice("language-".length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ function parseCodeBlock(n: Node, pc: PartCreator): Part[] {
|
|||
}
|
||||
|
||||
function parseHeader(n: Node, pc: PartCreator): Part[] {
|
||||
const depth = parseInt(n.nodeName.substr(1), 10);
|
||||
const depth = parseInt(n.nodeName.slice(1), 10);
|
||||
const prefix = pc.plain("#".repeat(depth) + " ");
|
||||
return [prefix, ...parseChildren(n, pc)];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue