@minamorl/markdown-next 2.1.1 → 2.2.0
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/lib/src/parser.js +5 -3
- package/package.json +1 -1
package/lib/src/parser.js
CHANGED
|
@@ -118,10 +118,11 @@ class Parser {
|
|
|
118
118
|
return mapper(tag)(join(children));
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
|
-
// Math expressions
|
|
121
|
+
// Math expressions - output raw $...$ for MathJax to process
|
|
122
122
|
// Inline math: $...$
|
|
123
123
|
const mathInline = P.seqMap(P.string("$").notFollowedBy(P.string("$")), P.regexp(/[^\$\r\n]+/), P.string("$"), (_1, content, _3) => {
|
|
124
|
-
|
|
124
|
+
// Output raw $...$ for MathJax auto-detection
|
|
125
|
+
return "$" + content + "$";
|
|
125
126
|
});
|
|
126
127
|
const inline = P.alt(pluginInline, aozoraRuby, anchor, img, em, strong, code, mathInline, htmlSelfClosing, htmlElement, P.regexp(/[^\r\n<=-\[\]\*\`\@|\$]+/), P.regexp(/./));
|
|
127
128
|
// Table cell content - supports inline elements
|
|
@@ -362,7 +363,8 @@ class Parser {
|
|
|
362
363
|
// Content can include anything except $$ (including single $, newlines, etc.)
|
|
363
364
|
const mathBlockContent = P.regexp(/[\s\S]*?(?=\$\$)/);
|
|
364
365
|
const mathBlock = P.seqMap(P.regexp(/^\$\$/), mathBlockContent, P.string("$$"), P.alt(linebreak, P.eof), (_1, content, _3, _4) => {
|
|
365
|
-
|
|
366
|
+
// Output raw $$...$$ for MathJax auto-detection
|
|
367
|
+
return "$$" + content.trim() + "$$";
|
|
366
368
|
});
|
|
367
369
|
const block = P.alt(P.regexp(/\s+/).result(""), pluginBlock, h1Special, h2Special, h6, h5, h4, h3, h2, h1, table, codeBlock, mathBlock, lists, blockquote, paragraph, linebreak.result(""));
|
|
368
370
|
this.acceptables = P.alt(block).many().map(join);
|
package/package.json
CHANGED