We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e12bf40 commit c92135aCopy full SHA for c92135a
3 files changed
tools/lint-md/lint-md.mjs
@@ -10748,6 +10748,7 @@ const findAndReplace =
10748
const replace = pairs[pairIndex][1];
10749
let start = 0;
10750
const index = parent.children.indexOf(node);
10751
+ let change = false;
10752
let nodes = [];
10753
let position;
10754
find.lastIndex = 0;
@@ -10763,9 +10764,7 @@ const findAndReplace =
10763
10764
if (typeof value === 'string') {
10765
value = value.length > 0 ? {type: 'text', value} : undefined;
10766
}
- if (value === false) {
10767
- position = undefined;
10768
- } else {
+ if (value !== false) {
10769
if (start !== position) {
10770
nodes.push({
10771
type: 'text',
@@ -10778,19 +10777,20 @@ const findAndReplace =
10778
10777
nodes.push(value);
10779
10780
start = position + match[0].length;
+ change = true;
10781
10782
if (!find.global) {
10783
break
10784
10785
match = find.exec(node.value);
10786
10787
- if (position === undefined) {
10788
- nodes = [node];
10789
+ if (change) {
10790
if (start < node.value.length) {
10791
nodes.push({type: 'text', value: node.value.slice(start)});
10792
10793
parent.children.splice(index, 1, ...nodes);
+ } else {
+ nodes = [node];
10794
10795
return index + nodes.length
10796
tools/lint-md/package-lock.json
tools/lint-md/package.json
@@ -16,7 +16,7 @@
16
"devDependencies": {
17
"@rollup/plugin-commonjs": "^22.0.1",
18
"@rollup/plugin-node-resolve": "^13.3.0",
19
- "rollup": "^2.76.0",
+ "rollup": "^2.77.0",
20
"rollup-plugin-cleanup": "^3.2.1"
21
22
0 commit comments