mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 17:32:38 +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:
@@ -211,8 +211,8 @@ const 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(/.*\^\^(.+)\^\^/)?.index; }, // Hint to Marked.js to stop and check for a match
|
||||||
tokenizer(src, tokens) {
|
tokenizer(src, tokens) {
|
||||||
const superRegex = /.*\^\^(.+)\^\^/y;
|
const superRegex = /\^\^(.+)\^\^/y;
|
||||||
const subRegex = /.*\^\^\^(.+)\^\^\^/y;
|
const subRegex = /\^\^\^(.+)\^\^\^/y;
|
||||||
let isSuper = false;
|
let isSuper = false;
|
||||||
let match = subRegex.exec(src);
|
let match = subRegex.exec(src);
|
||||||
if(!match){
|
if(!match){
|
||||||
@@ -220,10 +220,7 @@ const superSubScripts = {
|
|||||||
if(match) {
|
if(match) {
|
||||||
isSuper = true;
|
isSuper = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log(src);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(match?.length) {
|
if(match?.length) {
|
||||||
const tags = this.lexer.inlineTokens(match[1]);
|
const tags = this.lexer.inlineTokens(match[1]);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user