-
-
Notifications
You must be signed in to change notification settings - Fork 124
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 Support for <mark> #352
Comments
I find the This opens up the possibility of allowing HTML tags in the text. Indeed that is one of Markdown's nifty features, passing HTML tags directly to the output. |
I'm definitely not planning on making novelWriter a full markdown editor. There are plenty of excellent ones out there already, including the very editor I use for writing novelWriter itself. The The features I'm considering adding are mark and quotes. They are both trivial to add as they can reuse existing parsing logic and easily be implemented into the tokenizer for the HTML converter. |
There is a huge amount of scope creep involved in making novelWriter a full markdown editor. novelWriter's meant for writing novels. It's not clear to me how you convert novelWriter Markdown into HTML because I've not looked at the underlying codebase. My guess is you're not using any existing Markdown converter. This is good because it reduces the amount of dependencies. Choosing not to use Pandoc to produce LaTeX and PDF was a good move for the same reason. If I want to do something fancier with a novel, I have the option of exporting it out of novelWriter and hacking on the Markdown with another tool. This is my long winded way of saying I agree with your approach. |
Precisely. I am happy to add features that are clearly useful for providing the core text of a novel, but I want to keep the scope narrow. I'm using Python, which gives me more flexibility of run environments, but limits how much I can modify the core widget classes of Qt to add features they don't already have. While it is usually technically possible, it will quickly slow down the application. At the moment, novelWriter is relatively responsive and fast (with a few exceptions when working with very large files). I don't intend novelWriter to be used for writing non-fiction. Especially technical or academic work that requires a lot of research and the ability to add references etc. That is best done in a full featured text editor, or more sensibly (in my opinion) in LaTeX. I've written a couple of theses in my time ...
The tokenizer is custom written to handle a number of novelWriter-specific settings like page layouts and header formatting, tag parsing etc. So using a standard converter isn't an option. Also, the tokenizer class itself only produces a Python list with one entry per line in the source file. It will note what type of line it is, its original line number, the cleaned up text, the formatting to be applied at specific locations in the text, and the overall style of the line (alignment flags mostly). You have to subclass it to produce and implement a convert function to do the final conversion from the token list to another format. It was written this way since I had subclasses for HTML, plain text, LaTeX, markdown, etc in the original implementation. I'm still considering adding my own ODF subclass. The core tokenizer function isn't big, but probably a bit hard to follow: https://github.com/vkbo/novelWriter/blob/master/nw/core/tokenizer.py#L287 In addition, a second pass is run on the token array to apply layout-specific header formatting and auto-replaces. the final conversion is done as a third pass in a subclass dedicated to the format. For HTML it's |
Added a feature #595 for the part about block quotes mentioned here. I've started on a branch, but I wasn't very happy with the result, so I will probably try a different approach when I'm done messing with the export code. I've added proper ODT export in the |
After some code tinkering and testing, I've decided to not implement this feature. I have a different proposal that may be better in #705. |
It may be useful to add support for the HTML
<mark>
tag. It isn't part of Makrdown, but for instance editors like Zim supports it.Personally, I find it mostly useful in note files as a way of highlighting text. As for markdown tags for it,
==text==
is one option. For it to work, syntax highlighting themes need a highlight syntax class for background and text. Fallback can be to invert the regular colours.The text was updated successfully, but these errors were encountered: