Refactor micromark token handling to remove optional Token.htmlFlowChildren property and make related code more efficient for a ~6% elapsed time reduction.

This commit is contained in:
David Anson 2023-09-02 12:07:14 -07:00
parent e282874fe3
commit 24c97a54fb
16 changed files with 274 additions and 283 deletions

View file

@ -2574,57 +2574,6 @@ Generated by [AVA](https://avajs.dev).
},
{
children: [
{
children: [],
endColumn: 4,
endLine: 43,
startColumn: 1,
startLine: 43,
text: '<p>',
type: 'htmlFlowData',
},
{
children: [],
endColumn: 1,
endLine: 44,
startColumn: 4,
startLine: 43,
text: `␊
`,
type: 'lineEnding',
},
{
children: [],
endColumn: 11,
endLine: 44,
startColumn: 1,
startLine: 44,
text: 'HTML block',
type: 'htmlFlowData',
},
{
children: [],
endColumn: 1,
endLine: 45,
startColumn: 11,
startLine: 44,
text: `␊
`,
type: 'lineEnding',
},
{
children: [],
endColumn: 5,
endLine: 45,
startColumn: 1,
startLine: 45,
text: '</p>',
type: 'htmlFlowData',
},
],
endColumn: 5,
endLine: 45,
htmlFlowChildren: [
{
children: [
{
@ -2717,6 +2666,8 @@ Generated by [AVA](https://avajs.dev).
type: 'content',
},
],
endColumn: 5,
endLine: 45,
startColumn: 1,
startLine: 43,
text: `<p>
@ -3224,47 +3175,6 @@ Generated by [AVA](https://avajs.dev).
],
endColumn: 35,
endLine: 51,
htmlFlowChildren: [
{
children: [
{
children: [
{
children: [
{
children: [],
endColumn: 35,
endLine: 51,
startColumn: 1,
startLine: 51,
text: '<!-- markdownlint-disable-file -->',
type: 'htmlTextData',
},
],
endColumn: 35,
endLine: 51,
startColumn: 1,
startLine: 51,
text: '<!-- markdownlint-disable-file -->',
type: 'htmlText',
},
],
endColumn: 35,
endLine: 51,
startColumn: 1,
startLine: 51,
text: '<!-- markdownlint-disable-file -->',
type: 'paragraph',
},
],
endColumn: 35,
endLine: 51,
startColumn: 1,
startLine: 51,
text: '<!-- markdownlint-disable-file -->',
type: 'content',
},
],
startColumn: 1,
startLine: 51,
text: '<!-- markdownlint-disable-file -->',

View file

@ -10917,6 +10917,14 @@ Generated by [AVA](https://avajs.dev).
This \`is␊
also␊
very\` **bad** {MD050}␊
<p>HTML __should__ *be* ignored</p>
<p>
HTML __should__ *be* ignored␊
</p>
<!-- markdownlint-configure-file { "no-inline-html": false } -->
`,
}
@ -30582,7 +30590,7 @@ Generated by [AVA](https://avajs.dev).
insertText: `␊
`,
},
lineNumber: 83,
lineNumber: 98,
ruleDescription: 'Files should end with a single newline character',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md047.md',
ruleNames: [
@ -30679,7 +30687,22 @@ Generated by [AVA](https://avajs.dev).
text␊
<p>
1. Not a␊
2. list␊
</p>
<p>1. Not a list</p>
<p>
* Not a␊
* list␊
</p>
<p>* Not a list</p>
<!-- markdownlint-configure-file {␊
"no-inline-html": false,␊
"ul-style": false,␊
"ol-prefix": false,␊
"fenced-code-language": false␊