0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 16:12:37 +00:00

Add subscript and subscript markdown tokens

Uses ^^ for superscript and ^^^ subscript as wrappers in the same
pattern as italics and bold ( * and **, respectively)

Adds editor hot-keys and sytax highlighting. (CTRL-6/CTRL-7)

Exact values may not be ideal. Short of the suggestted overloading of ~,
I didn't see a better option for the delimiter.
This commit is contained in:
David Bolack
2023-11-08 00:54:43 -06:00
parent f1ca6eeee2
commit d43ea46e40

View File

@@ -211,8 +211,8 @@ const superSubScripts = {
level : 'inline',
start(src) { return src.match(/.*\^\^(.+)\^\^/)?.index; }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const superRegex = /.*\^\^(.+)\^\^/y;
const subRegex = /.*\^\^\^(.+)\^\^\^/y;
const superRegex = /\^\^(.+)\^\^/y;
const subRegex = /\^\^\^(.+)\^\^\^/y;
let isSuper = false;
let match = subRegex.exec(src);
if(!match){
@@ -220,10 +220,7 @@ const superSubScripts = {
if(match) {
isSuper = true;
}
} else {
console.log(src);
}
if(match?.length) {
const tags = this.lexer.inlineTokens(match[1]);
return {