我试图突出显示模式%()%
中的所有子字符串htmlmixed
。匹配的正则表达式是([%(](.*)[)%])
.
这是我用于 CodeMirror 的代码:
const code = CodeMirror.fromTextArea(document.querySelector("#id"), {
theme: "dracula",
mode: "text/html",
lineNumbers: true,
firstLineNumber: 1,
spellcheck: false,
autocorrect: true,
extraKeys: { "Ctrl-Space": "autocomplete" },
styleActiveLine: true,
highlightSelectionMatches: { showToken: /\w/, annotateScrollbar: true }
});
谢谢