diff --git a/src/internal/parser.pegjs b/src/internal/parser.pegjs index 7fc13ef5ac2f78cfe6f9d3d83b9fb19efdbbf375..0adce8e51924567dfb958329ab29437bccaf3d6d 100644 --- a/src/internal/parser.pegjs +++ b/src/internal/parser.pegjs @@ -401,14 +401,13 @@ link linkLabel = parts:linkLabelPart+ { - return parts.flat(); + return parts; } linkLabelPart - = "[" linkLabelPart* "]" linkLabelPart* &("](" url:linkUrl ")") -{ return applyParser(text(), 'inlineParser'); } - / !"]" n:plain -{ return n; } + = url { return text(); /* text node */ } + / link { return text(); /* text node */ } + / !"]" n:inline { return n; } linkUrl = url { return text(); } diff --git a/src/internal/util.ts b/src/internal/util.ts index 44c1f619a2c024aca60805fa03fcdf1da8a81773..9bfec389a33b7bd0659dba75a693eb7b41c67321 100644 --- a/src/internal/util.ts +++ b/src/internal/util.ts @@ -19,10 +19,6 @@ export function mergeText(nodes: (MfmNode | string)[]): MfmNode[] { // Store the char. storedChars.push(node); } - else if (node.type == 'text') { - // Store the text. - storedChars.push(node.props.text); - } else { generateText(); dest.push(node);