diff --git a/src/internal/parser.pegjs b/src/internal/parser.pegjs index 7fc13ef..0adce8e 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 44c1f61..9bfec38 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);