0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 10:12:41 +00:00

A better regex for underlining.

This commit is contained in:
David Bolack
2023-12-13 21:47:55 -06:00
parent 04187cf769
commit a88b256b6c

View File

@@ -237,9 +237,9 @@ const superSubScripts = {
const underline = { const underline = {
name : 'underline', name : 'underline',
level : 'inline', level : 'inline',
start(src) { return src.match(/\w_[^_]_/m)?.index;}, start(src) { return src.match(/\b_(?![_\s])(.*?[^_\s])_\b/m)?.index;},
tokenizer(src, tokens) { tokenizer(src, tokens) {
const uRegex = /^_([^_]*)_/m; const uRegex = /^\b_(?![_\s])(.*?[^_\s])_\b/m;
const match = uRegex.exec(src); const match = uRegex.exec(src);
console.log('Looking'); console.log('Looking');
if(match?.length) { if(match?.length) {