@minamorl/markdown-next 2.1.0 → 2.1.1
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 +6 -3
- package/package.json +1 -1
package/lib/src/parser.js
CHANGED
|
@@ -179,7 +179,9 @@ class Parser {
|
|
|
179
179
|
const paragraph = paragraphLine
|
|
180
180
|
.map(mapper("p"));
|
|
181
181
|
const listIndent = P.string(" ");
|
|
182
|
-
|
|
182
|
+
// List item content - supports inline elements including math
|
|
183
|
+
const liInlineContent = P.alt(mathInline, anchor, img, em, strong, code, P.regexp(/[^\r\n\[\]\*\`\$]+/), P.regexp(/./));
|
|
184
|
+
const liSingleLine = liInlineContent.atLeast(0).map(join);
|
|
183
185
|
const ulStart = P.string("- ").or(P.string("* "));
|
|
184
186
|
const olStart = P.regexp(/[0-9]+\. /);
|
|
185
187
|
let liLevel = [1];
|
|
@@ -357,8 +359,9 @@ class Parser {
|
|
|
357
359
|
: join([_1, pluginName, args, _2, content]);
|
|
358
360
|
});
|
|
359
361
|
// Block math: $$...$$ (must be on its own line or surrounded by newlines)
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
+
// Content can include anything except $$ (including single $, newlines, etc.)
|
|
363
|
+
const mathBlockContent = P.regexp(/[\s\S]*?(?=\$\$)/);
|
|
364
|
+
const mathBlock = P.seqMap(P.regexp(/^\$\$/), mathBlockContent, P.string("$$"), P.alt(linebreak, P.eof), (_1, content, _3, _4) => {
|
|
362
365
|
return mapper("div", { class: "math math-display", "data-math": content.trim() })(content.trim());
|
|
363
366
|
});
|
|
364
367
|
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(""));
|
package/package.json
CHANGED