Skip to content

Commit e55606e

Browse files
committedFeb 1, 2024
Refactor to improve performance of deep trees
1 parent 45aeac2 commit e55606e

File tree

69 files changed

+364
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+364
-70
lines changed
 

Diff for: ‎packages/remark-lint-blockquote-indentation/index.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@
122122
* Configuration.
123123
*/
124124

125+
import {phrasing} from 'mdast-util-phrasing'
125126
import pluralize from 'pluralize'
126127
import {lintRule} from 'unified-lint-rule'
127128
import {pointStart} from 'unist-util-position'
128-
import {visitParents} from 'unist-util-visit-parents'
129+
import {SKIP, visitParents} from 'unist-util-visit-parents'
129130

130131
const remarkLintBlockquoteIndentation = lintRule(
131132
{
@@ -156,7 +157,14 @@ const remarkLintBlockquoteIndentation = lintRule(
156157
)
157158
}
158159

159-
visitParents(tree, 'blockquote', function (node, parents) {
160+
visitParents(tree, function (node, parents) {
161+
// Do not walk into phrasing.
162+
if (phrasing(node)) {
163+
return SKIP
164+
}
165+
166+
if (node.type !== 'blockquote') return
167+
160168
const start = pointStart(node)
161169
const headStart = pointStart(node.children[0])
162170

Diff for: ‎packages/remark-lint-blockquote-indentation/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
],
3434
"dependencies": {
3535
"@types/mdast": "^4.0.0",
36+
"mdast-util-phrasing": "^4.0.0",
3637
"pluralize": "^8.0.0",
3738
"unified-lint-rule": "^2.0.0",
3839
"unist-util-position": "^5.0.0",

0 commit comments

Comments
 (0)