Skip to content
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

Allow markdown within a word #1444

Closed
Tracked by #1541
HeyMyian opened this issue May 15, 2023 · 2 comments · Fixed by #1540
Closed
Tracked by #1541

Allow markdown within a word #1444

HeyMyian opened this issue May 15, 2023 · 2 comments · Fixed by #1540
Assignees
Labels
editor Component: Editor enhancement Request: New feature or improvement next release Note: Features planned for next release

Comments

@HeyMyian
Copy link
Contributor

I find it useful to allow markdown within a word, specifically italics, to emphasize a certain part.

_penni_less --> penniless
**penni**less --> penniless
~~penni~~less --> penniless
Neither work, they output (build tool) the markdown symbols instead applying the formatting. The syntax highlighter also does not recognize it.

Not sure if bug or feature request. I thought not recognizing it was standard markdown behavior, but Discord and GitHub for example know how to deal with it.

@HeyMyian HeyMyian added the enhancement Request: New feature or improvement label May 15, 2023
@vkbo
Copy link
Owner

vkbo commented May 16, 2023

This is defined behaviour: https://novelwriter.io/docs/usage_format.html#text-emphasis

The Markdown standard allows for it, but not all implementations support it. novelWriter does not, and changing it would have a lot of implications.

The main issue now is that syntax highlighting uses regex to process the formatting. Standard Markdown cannot in general be process with single regex filters though, so that puts a limit on this. I have considered writing a custom parser that uses programmed logic to determine formatting, and I already do this for headers, meta data and comments, but not for body text. Mostly because iterating through text character by character is fairly slow in Python.

I may have to revisit this anyway due to other requested features, so I can take this request into consideration as well in the process.

@vkbo vkbo added potential feature Request: May be considered later editor Component: Editor labels May 16, 2023
@vkbo vkbo self-assigned this May 16, 2023
@vkbo
Copy link
Owner

vkbo commented Oct 19, 2023

Have a look in issue #1337.

I am working on a suitable syntax for sub/superscript, and I think the syntax can be extended to support special cases of complex formatting like you request here. I'm proposing to use {xx:text} notation for inserting custom things in the text, where xx is a code, and text the text to apply it to. In a branch I've added codes for bold and italics as well, and since this is presumably not something you need very often, it's not a too clunky syntax. The highlighter helps make it stand out too.

Join the thread and let me know what you think. I don't want to split the discussion into two places. This notation can also be used for footnotes, and perhaps other features too since it is very flexible and incredibly easy to parse.

@vkbo vkbo added this to the Release 2.2 Beta 1 milestone Oct 19, 2023
@vkbo vkbo added next release Note: Features planned for next release and removed potential feature Request: May be considered later labels Oct 19, 2023
@vkbo vkbo linked a pull request Oct 19, 2023 that will close this issue
6 tasks
@vkbo vkbo mentioned this issue Oct 20, 2023
8 tasks
@vkbo vkbo closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Component: Editor enhancement Request: New feature or improvement next release Note: Features planned for next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants