mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-23 12:17:07 +00:00
Update Editor highlighting for Definition Lists
Fixes syntax highlighting to account for multiple definitions on a definition list.
This commit is contained in:
1 parent
ce1ba8289c
commit
e6428a3b18
1 file changed
+6
-1
@@ -154,9 +154,14 @@ const Editor = createClass({
|
||||
const regex = /^([^\n]*?)::([^\n]*)(?:\n|$)/ym;
|
||||
let match;
|
||||
while ((match = regex.exec(line)) != null){
|
||||
|
||||
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[0]) }, { line: lineNumber, ch: line.indexOf(match[0]) + match[0].length }, { className: 'define' });
|
||||
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length }, { className: 'term' });
|
||||
codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[2]) }, { line: lineNumber, ch: line.indexOf(match[2]) + match[2].length }, { className: 'definition' });
|
||||
const matches = match[2].split('::').map((s)=>(s.trim()));
|
||||
matches.forEach((m)=>{
|
||||
codeMirror.markText({ line: lineNumber, ch: line.indexOf(m) }, { line: lineNumber, ch: line.indexOf(m) + m.length }, { className: 'definition' });
|
||||
});
|
||||
// codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[2]) }, { line: lineNumber, ch: line.indexOf(match[2]) + match[2].length }, { className: 'definition' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user