@diplodoc/transform 4.73.2 → 4.73.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/_yfm-only.css.map +1 -1
- package/dist/css/_yfm-only.min.css.map +1 -1
- package/dist/css/base.css.map +1 -1
- package/dist/css/base.min.css.map +1 -1
- package/dist/css/print.css.map +1 -1
- package/dist/css/yfm.css.map +1 -1
- package/dist/css/yfm.min.css.map +1 -1
- package/lib/plugins/anchors/index.js +4 -1
- package/lib/plugins/anchors/index.js.map +1 -1
- package/lib/plugins/term/index.js +24 -5
- package/lib/plugins/term/index.js.map +1 -1
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/transform/plugins/anchors/index.ts +4 -1
- package/src/transform/plugins/term/index.ts +24 -5
- package/src/transform/utils.ts +1 -1
|
@@ -139,10 +139,21 @@ function collectTermsFromRawContent(tokens: Token[], reg: RegExp, out: Set<strin
|
|
|
139
139
|
collectRawTermMatches(token.content, reg, out);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
if (token.type === 'inline'
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
if (token.type === 'inline') {
|
|
143
|
+
// Scan the raw inline content to catch term references that
|
|
144
|
+
// may have been split across child tokens by emphasis parsing.
|
|
145
|
+
// When term definitions come from includes resolved after inline
|
|
146
|
+
// parsing, term_inline fails and `(*key)` gets fragmented by
|
|
147
|
+
// the `*` emphasis delimiter — making per-child scanning miss them.
|
|
148
|
+
if (token.content) {
|
|
149
|
+
collectRawTermMatches(token.content, reg, out);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (token.children) {
|
|
153
|
+
for (const child of token.children) {
|
|
154
|
+
if (child.type === 'code_inline' && child.content) {
|
|
155
|
+
collectRawTermMatches(child.content, reg, out);
|
|
156
|
+
}
|
|
146
157
|
}
|
|
147
158
|
}
|
|
148
159
|
}
|
|
@@ -386,7 +397,15 @@ const term: MarkdownItPluginCb = (md, options) => {
|
|
|
386
397
|
alt: ['paragraph', 'reference'],
|
|
387
398
|
});
|
|
388
399
|
|
|
389
|
-
|
|
400
|
+
// Register termReplace after text_join so that emphasis-split text
|
|
401
|
+
// tokens (e.g. [text](*key) where * opens a delimiter) are merged
|
|
402
|
+
// before the term regex runs. Without this, terms defined in
|
|
403
|
+
// included files (resolved after inline parsing) would be missed.
|
|
404
|
+
try {
|
|
405
|
+
md.core.ruler.after('text_join', 'termReplace', termReplace);
|
|
406
|
+
} catch {
|
|
407
|
+
md.core.ruler.after('linkify', 'termReplace', termReplace);
|
|
408
|
+
}
|
|
390
409
|
};
|
|
391
410
|
|
|
392
411
|
export = term;
|
package/src/transform/utils.ts
CHANGED
|
@@ -57,7 +57,7 @@ export function headingInfo(tokens: Token[], idx: number) {
|
|
|
57
57
|
while (inlineToken.children && i < inlineToken.children.length) {
|
|
58
58
|
const token = inlineToken.children[i];
|
|
59
59
|
|
|
60
|
-
if (token.type === 'text') {
|
|
60
|
+
if (token.type === 'text' || token.type === 'text_special') {
|
|
61
61
|
title += token.content;
|
|
62
62
|
}
|
|
63
63
|
|