diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 7dbc32f1a..83badb05e 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -239,9 +239,24 @@ const underline = { level : 'inline', start(src) { return src.match(/\w_[^_]_/m)?.index;}, tokenizer(src, tokens) { - const uRegex = /^_(?!\s)(?=([^_]*[^\s]))\1\^/m; + const uRegex = /^_([^_]*)_/m; + const match = uRegex.exec(src); + console.log('Looking'); + if(match?.length) { + console.log('found!'); + console.log(match); + return { + type : 'underline', + raw : match[0], + tokens : this.lexer.inlineTokens(match[1]) + }; + } + }, + renderer(token) { + console.log() + return `${this.parser.parseInline(token.tokens)}`; } -} +}; const definitionLists = { name : 'definitionLists', @@ -275,7 +290,7 @@ const definitionLists = { } }; -Marked.use({ extensions: [mustacheSpans, mustacheDivs, mustacheInjectInline, definitionLists, superSubScripts] }); +Marked.use({ extensions: [mustacheSpans, mustacheDivs, mustacheInjectInline, definitionLists, superSubScripts, underline] }); Marked.use(mustacheInjectBlock); Marked.use({ renderer: renderer, mangle: false }); Marked.use(MarkedExtendedTables(), MarkedGFMHeadingId(), MarkedSmartypantsLite());