0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 20:22:42 +00:00

Update Regex based on PR siuggestions.

This should match more economically and in line with marked
recomendations as well as not allow whitespace ( \s ) at the beginning
or end of a sub or superscript mark. Additionally, a failure in having
mixed sub and supers on the same line was corrected.
This commit is contained in:
David Bolack
2023-11-09 21:31:08 -06:00
parent a762626c53
commit 7b9a23670d

View File

@@ -209,10 +209,10 @@ const mustacheInjectBlock = {
const superSubScripts = {
name : 'superSubScripts',
level : 'inline',
start(src) { return src.match(/.*\^\^(.+)\^\^/)?.index; }, // Hint to Marked.js to stop and check for a match
start(src) { return src.match(/\^\^[^\s].+[^\s]\^\^/m)?.index; }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const superRegex = /\^\^(.+)\^\^/y;
const subRegex = /\^\^\^(.+)\^\^\^/y;
const superRegex = /^\^\^([^\s\^][^\^]*[^\s\^])\^\^/m;
const subRegex = /^\^\^\^([^\s\^][^\^]*[^\s\^])\^\^\^/m;
let isSuper = false;
let match = subRegex.exec(src);
if(!match){