-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make the overlayMode working? #495
Comments
Highlighting LaTeX inside code blocks is pretty simple, all it takes is adding Highlighting outside a code block is slightly trickier, but the const easyMDE = new EasyMDE({
overlayMode: {
mode: CodeMirror.getMode({}, 'stex'),
combine: true,
},
spellChecker: false, // Does not work with the spell checker enabled.
}); Unfortunately the Alternatively you can use After setting CodeMirror on the window you can load in In the end my working editor looked like this: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LaTeX</title>
<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.8/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.8/mode/stex/stex.min.js"></script>
</head>
<body>
<textarea></textarea>
<script>
const easyMDE = new EasyMDE({
overlayMode: {
mode: CodeMirror.getMode({}, 'stex'),
combine: true,
},
spellChecker: false,
});
</script>
</body>
</html> I hope this helps you! |
Dear Jeroen, |
Since exposing CodeMirror isn't an options anymore, I've came up with a workaround that might work for other as well.
You might need to combine/multiplex the desired mode with the "gfm" mode, for example see: @Ionaru a possible bug I encountered is when using |
Hello to all the developers of EasyMDE. Thanks for such a great editor!
I would like add additional highlighting during editing. In particular, I want to highlight TeX/LaTeX equations. I've found the CodeMirrors's "stex" mode, but I'm struggling to make it load using the overlayMode option.
What I've done:
I followed this guide on Hinty to add "stex" mode to the easymde.min.js. Everything should be correct as the size of easymde.min.js increased after adding "stex" mode.
Next, I tried different options to add the "stex" mode to overlayMode:
Then I've tried to create the mode object using CodeMirror.defineMode(...), and CodeMirror.getMode(...).
However, with no success in parsing and highlighting LaTeX equations during the editing. I'm sure that the solution is simple, but I couldn't get it working after searching and reading CodeMirror's docs. What am I doing wrong?
Thanks a lot!
The text was updated successfully, but these errors were encountered: