mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
Work around likely micromark bug in sliceSerialize (link to GitHub issue in code).
This commit is contained in:
parent
000281e2f0
commit
5038f6e154
1 changed files with 7 additions and 3 deletions
|
|
@ -41,11 +41,15 @@ function micromarkParse(markdown) {
|
||||||
const history = [ current ];
|
const history = [ current ];
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
const [ kind, token, context ] = event;
|
const [ kind, token, context ] = event;
|
||||||
const { type, start, end, _container } = token;
|
const { type, start, end } = token;
|
||||||
const { "column": startColumn, "line": startLine } = start;
|
const { "column": startColumn, "line": startLine } = start;
|
||||||
const { "column": endColumn, "line": endLine } = end;
|
const { "column": endColumn, "line": endLine } = end;
|
||||||
// sliceSerialize throws when called for a _container
|
let text = null;
|
||||||
const text = _container ? null : context.sliceSerialize(token);
|
try {
|
||||||
|
text = context.sliceSerialize(token);
|
||||||
|
} catch {
|
||||||
|
// https://github.com/micromark/micromark/issues/131
|
||||||
|
}
|
||||||
if (kind === "enter") {
|
if (kind === "enter") {
|
||||||
const previous = current;
|
const previous = current;
|
||||||
history.push(previous);
|
history.push(previous);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue