novelWriter icon indicating copy to clipboard operation
novelWriter copied to clipboard

Allow converting between asterisk (*) and underscore (_) for italics and bold

Open mattsmi opened this issue 4 months ago • 3 comments

Markdown appears to state that either a single asterisk or a single underscore is to be used for Italics. Double of either one will produce bold text, etc.

At the move novelWriter insists on an underscore for Italics and asterisks for bold. This makes it difficult to paste from another source, which has valid Markdown, but just not in the stricter format chosen by novelWriter.

Would it be possible to support an asterisk or an underscore when indicating Italics or bold text, as is supported by Markdown?

Many thanks for yiour great work!

mattsmi avatar Jul 26 '25 08:07 mattsmi

While Markdown is nice on paper, it is actually really hard to process. At least if following the full spec. There are so many possible corner cases, and some of them are not possible to cover with regular expressions, which is what novelWriter uses. I spent a lot of time trying to make it more flexible early on when making novelWriter, but in the end it was both less error-prone and faster to restrict the syntax options.

This is mentioned in the documentation too: https://novelwriter.io/docs/usage/basic_formatting.html#text-emphasis-with-markdown

I plan to add a text import tool where formatted text will be pre-processed. I think it is better to adapt this to make the * to _ conversion. I'll keep this feature request open, but rename and link it to the import feature instead. I plan to make one version that opens a dialog with a text box where you can paste formatted text, and it will clean it up and insert it into the editor using novelWriter formatting syntax.

vkbo avatar Jul 26 '25 10:07 vkbo

Thank you.

mattsmi avatar Jul 27 '25 06:07 mattsmi

Don't close it. This isn't implemented yet.

vkbo avatar Jul 27 '25 09:07 vkbo