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)
- Extremely slow performance on Mac, over 1000 items but all small HOT 11
- Text before or after image is deleted while/after editing alt text of image HOT 2
- Responsive Toolbar Layout for Narrower Window Widths HOT 2
- Table Editor is not supporting blank cells / empty cells HOT 2
- Unable to Insert Image from Clipboard HOT 2
- Add Listing of Footnotes and Comments to the Sidebar
- Insert Table Button can not create a table with more columns than rows HOT 1
- Update default number-sections settings according to new behaviour pandoc. HOT 4
- Image pop-up for internal note links HOT 2
- Unconfuse Save Unsaved Changes Dialog HOT 3
- Add a "Remove Link" option in the right-click context menu for links. HOT 1
- [macOS] The menu entry paste without styling doesn't work HOT 4
- Internal links get exported if on a multiple elements' bullet list HOT 5
- [Develop] Improve CodeMirror state handling
- Tabular Data is Not-Saved/Deleted HOT 2
- [3.1.0-beta.1] Can't open files in file manager with mouse click HOT 10
- In Latex export when setting only width as percentage, height is set to 100% instead of leaving image aspect ratio to control it. HOT 6
- [3.1.0-beta.1] Can't open files in file manager with mouse click HOT 1
- [3.1.0-beta.1] Keyboard shortcut not working for New File and New Directory HOT 3
- [3.1.0-beta.1] [macOS] When closing via Dock, the unsaved changes popup gives the same 2 options 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.