mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 03:32:40 +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:
@@ -209,10 +209,10 @@ const mustacheInjectBlock = {
|
|||||||
const superSubScripts = {
|
const superSubScripts = {
|
||||||
name : 'superSubScripts',
|
name : 'superSubScripts',
|
||||||
level : 'inline',
|
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) {
|
tokenizer(src, tokens) {
|
||||||
const superRegex = /\^\^(.+)\^\^/y;
|
const superRegex = /^\^\^([^\s\^][^\^]*[^\s\^])\^\^/m;
|
||||||
const subRegex = /\^\^\^(.+)\^\^\^/y;
|
const subRegex = /^\^\^\^([^\s\^][^\^]*[^\s\^])\^\^\^/m;
|
||||||
let isSuper = false;
|
let isSuper = false;
|
||||||
let match = subRegex.exec(src);
|
let match = subRegex.exec(src);
|
||||||
if(!match){
|
if(!match){
|
||||||
|
|||||||
Reference in New Issue
Block a user