Comments (4)
I see where you get to but this is rather monkey patching-like. I'm not sure that's the best way. In the past months when I was developing Zettlr, I always resorted to monkey-patching. This way I could cramp into the app many features as quickly as possible, and now I'm stuck with a lot of code refactoring. Besides, a simple document.replace
wouldn't suffice, as CodeMirror internally does a lot of stuff to the text before it is actually rendered. I guess we're stuck with two options:
- Manually adapt the gfm-mode to divide between the escaping character and the literal (which I would prefer)
- Add an option to either grey out both, or none of the characters.
As the gfm
-mode itself is just a superset of the markdown
-mode, maybe there's a way to override this behaviour manually. If so, I'll stick with this, but this requires some more research.
from zettlr.
Yep, this is a problem in the underlying Markdown parser from Codemirror, which does not differentiate between the escaping backlash and the literal character. It has annoyed me for some time myself. The problem would be that, if I manually alter the Markdown parser code then I won't be able to integrate CodeMirror updates so easily in the future, which is why I'm rather hesitant in doing this. I'll look into the chances of doing so!
from zettlr.
I see that the class cm-formatting-escape
is applied to the whole text \[
, so pure CSS wouldn't work.
But a combination of a regex like:
document = document.replace(/\\([[\]@])/ig, '\\<span class="nogrey">$1</span>');
together with a custom CSS rule for the nogrey
class could work? Tested on Regex101: https://regex101.com/r/Jq7xVr/3
EDIT: Added @
to the regex (so it recognizes \@
as well as \[
and \]
) and removed redundant backslash
from zettlr.
Tada!
from zettlr.
Related Issues (20)
- Zettlr should follow the system interface font HOT 5
- [Develop] Upgrade Linter System
- Crash Zettlr 3.10 HOT 30
- Alihment of bold and italic settings
- Launch error: `GLIBCXX_3.4.29 not found` HOT 14
- Focus tag filter after clicking tag selector
- Tag auto-completion doesn't recognise newly added tags until next restart HOT 2
- Ctrl-N (New File) opens file selector dialog, instead of simply creating the file HOT 3
- Context Menu Fails to Appear for Specific Reference Type HOT 1
- Partially checked / indeterminate checkboxes
- "Zettlr offers some basic git functionality" HOT 6
- Can't find and replace "\[" in the GUI. HOT 1
- Omit Authors in Inline Footnotes HOT 5
- Internal links not removed when exporting to Word HOT 2
- Version 3.1 does not remember last opened workspace HOT 2
- In split view, connect each pane to its own table of contents
- Saving fails for some files HOT 1
- Default to Last-Used Export Even When Custom Command HOT 1
- `musl` systems not supported HOT 4
- Apply the link CSS style to internal links with title HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zettlr.