0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 20:12:40 +00:00

Near complete

This commit is contained in:
David Bolack
2023-11-08 00:49:39 -06:00
parent d390d518a3
commit f1ca6eeee2
4 changed files with 71 additions and 31 deletions

View File

@@ -160,6 +160,24 @@ const Editor = createClass({
}
}
// Superscript
if(line.includes('^^') && !line.includes('^^^')) {
const regex = /.*\^\^(.+)\^\^/y;
let match;
while ((match = regex.exec(line)) != null) {
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) - 2 }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length + 2 }, { className: 'superscript' });
}
}
// Subscript
if(line.includes('^^^')) {
const regex = /.*\^\^\^(.+)\^\^\^/y;
let match;
while ((match = regex.exec(line)) != null) {
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) - 3 }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length + 3 }, { className: 'subscript' });
}
}
// Highlight injectors {style}
if(line.includes('{') && line.includes('}')){
const regex = /(?:^|[^{\n])({(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\2})/gm;

View File

@@ -43,6 +43,14 @@
font-weight : bold;
color : green;
}
.superscript:not(.cm-comment) {
font-weight : bold;
color : goldenrod;
}
.subscript:not(.cm-comment) {
font-weight : bold;
color : rgb(123, 123, 15);
}
}
.brewJump {