-
I am using ngx-markdown as a markdown viewer
-
If there is a link on clicking I’m trying to open the link in new
tab -
To handle marked bold, italic etc I’m using marked.parseInline
import { marked } from 'marked'; import { MARKED_OPTIONS, MarkdownModule, MarkedOptions, MarkedRenderer } from 'ngx-markdown'; export function markedOptionsFactory(): MarkedOptions { const renderer: any = new MarkedRenderer(); renderer.link = (linkObj) => { const parsedText = marked.parseInline(linkObj.text); return `<a href="${linkObj.href}" title="${linkObj.title || ''}" target="_blank" rel="noopener noreferrer">${parsedText}</a>`; }; return { renderer }; }
Error I'm getting is
main.js:23 ERROR RangeError: Maximum call stack size exceeded
Please report this to https://github.com/markedjs/marked.
at String.replace (<anonymous>)
at Td.lex (main.js:23:2146672)
at Function.lex [as lexer] (main.js:23:2146597)
at DV.link (main.js:1:17743759)
at tU.<computed> [as link] (main.js:23:2159956)
at EF.parseInline (main.js:23:2157113)
at Dd.paragraph (main.js:23:2153462)
at EF.parse (main.js:23:2156168)
at Function.parse [as parser] (main.js:23:2155250)
at main.js:1:17743788