You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a (non-functional) example of what I was attempting:
varlexers={chat: newmarked.InlineLexer([],{sanitize: true,smartypants:true,gfm:true}),content: newmarked.Lexer({sanitize: true,smartypants:true,gfm:true})};// disable images, but allow linkslexers.chat.rules.link=/^\[((?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*)\]\(\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*\)/;
Unfortunately, the Lexer and InlineLexer classes don't behave the same way, so...
varlexers={chat: newmarked.InlineLexer([],{sanitize: true,smartypants:true,gfm:true}),content: marked};// disable images, but allow linkslexers.chat.rules.link=/^\[((?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*)\]\(\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*\)/;
Should work, by exposing lexer.content( ) as a direct mapping to the non-inline Marked parser. Unfortunately, it doesn't -- the editing of the InlineLexer via changing the rules also impacts the second marked function.
As a workaround, I attempted:
varotherMarked=require('marked');varlexers={chat: neweval(marked.InlineLexer)([],{sanitize: true,smartypants:true,gfm:true}),content: otherMarked};// disable images, but allow linkslexers.chat.rules.link=/^\[((?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*)\]\(\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*\)/;
...to no avail. Perhaps we should unify the lexer structures and/or standardize how they are exposed?
The text was updated successfully, but these errors were encountered:
This is a (non-functional) example of what I was attempting:
Unfortunately, the
Lexer
andInlineLexer
classes don't behave the same way, so...Should work, by exposing
lexer.content( )
as a direct mapping to the non-inline Marked parser. Unfortunately, it doesn't -- the editing of the InlineLexer via changing the rules also impacts the second marked function.As a workaround, I attempted:
...to no avail. Perhaps we should unify the lexer structures and/or standardize how they are exposed?
The text was updated successfully, but these errors were encountered: