mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-03 19:12:41 +00:00
Simple Underline token.
Overrides __
This commit is contained in:
@@ -239,9 +239,24 @@ const underline = {
|
|||||||
level : 'inline',
|
level : 'inline',
|
||||||
start(src) { return src.match(/\w_[^_]_/m)?.index;},
|
start(src) { return src.match(/\w_[^_]_/m)?.index;},
|
||||||
tokenizer(src, tokens) {
|
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 `<u>${this.parser.parseInline(token.tokens)}</u>`;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const definitionLists = {
|
const definitionLists = {
|
||||||
name : '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(mustacheInjectBlock);
|
||||||
Marked.use({ renderer: renderer, mangle: false });
|
Marked.use({ renderer: renderer, mangle: false });
|
||||||
Marked.use(MarkedExtendedTables(), MarkedGFMHeadingId(), MarkedSmartypantsLite());
|
Marked.use(MarkedExtendedTables(), MarkedGFMHeadingId(), MarkedSmartypantsLite());
|
||||||
|
|||||||
Reference in New Issue
Block a user