-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add Markdown highlighting format #1894
Comments
Unfortunately, shortcodes are not parsed by the syntax highlighter, other than the code tag itself. Handling this would require nested parsing, since these are basically free form. The only way to really do it is to add Markdown-like highlighting with |
What are your thoughts on adding additional markdown for this? The visual effect would be consistent with the other markdown vs. shortcodes, where only the markdown variant changes how the text renders in the editor. I think it would be a nice-to-have feature, but perhaps there are some arguments against adding more and more markdown. |
Well, yes. Each markdown addition needs an independent rule which is processed on a text paragraph on every single key press you make. The nice thing about shortcodes is that they are all included in a single rule. so adding more comes at a minimal cost. That said, there's still room before keypresses become laggy (the spell checker also runs on the whole paragraph on each keypress) and we're not really hitting any issues yet that I know of. Python is relatively slow, but moder computers are also very fast. But I've noticed typing lag in other Python-based apps because there is too much processing going on when you type, and that is annoying. Especially for a writing app. Anyway, I can add the |
If it wasn't for the fact that novelWriter runs on Python, I would probably write a parser that didn't rely on regular expressions. That way I could process character by character and flag formatting on and off as needed. I've written parser like this before in machine code compiled languages, and they are plenty fast enough, and have the ability to accept any rule logic I want. I fear this will be too slow on Python, but I may give it another try at some point. Especially if there are too many highlight rules. The non-text blocks (headings, keywords, comments, footnotes) already uses this style of parsing rather than regex. |
It looks to me like we're far off reaching any performance issues. I have this old 2011 Intel Atom N450 netbook lying around where I recently installed antiX Linux on to see if I could still use it for writing (I could)(but I don't). This thing is really slow and can barely handle a web browser. I see no issues at all though typing in novelWriter; keystrokes are crisp. Out of curiosity, what are those Python apps you've seen where typing is laggy? |
I renamed this to "Add Markdown highlighting format" instead, as that's the solution to add actual formatting to the editor. I'll use the syntax discussed before, which was a non-standard Markdown format using |
Is there a chance we could get the highlight background color as it is displayed in the document viewer also in the document editor? I next to never use the document viewer, but having a more eye-catching highlight color for marked stuff could be useful in the editor too. Unsure if technically possible.
1) Current viewer
![2024-05-24___00_00_31](https://private-user-images.githubusercontent.com/60368695/333354913-9dde3811-6915-4c98-a4b7-39ac3fb544f3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwMzY5MTIsIm5iZiI6MTcxOTAzNjYxMiwicGF0aCI6Ii82MDM2ODY5NS8zMzMzNTQ5MTMtOWRkZTM4MTEtNjkxNS00Yzk4LWE0YjctMzlhYzNmYjU0NGYzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDA2MTAxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTliZGFhMTBhOGFjNDNhYjkwOGU0ZmIwYmEwMjFlYTEzYmE0OTg1MTM2ZGE0YzVmN2Y1N2VmNzRlNjE0ZDY1OGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.yMpuxKifLiBpef7r7PcY6ARWudkFZkiuOc5pETVUonY)
2) Current editor
3) Proposed editor
The text was updated successfully, but these errors were encountered: