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

Strike through fails if it includes a space #330

Closed
johnblommers opened this issue Jun 21, 2020 · 4 comments · Fixed by #338
Closed

Strike through fails if it includes a space #330

johnblommers opened this issue Jun 21, 2020 · 4 comments · Fixed by #338
Assignees
Labels
documentation Request: Changes to documentation not a bug Invalid: Feature, not a bug

Comments

@johnblommers
Copy link

Strike through fails if it includes a space. For example the following does not strike out the word Dublin and the space after it:

~~Dublin ~~: The rain in ~~Dublin ~~Spain falls mainly on the plain.

Therefore we have to do this:

~~Dublin~~: The rain in DublinSpain falls mainly on the plain.

Or

~~Dublin~~ : The rain in Dublin Spain falls mainly on the plain.

Of course as I previewed this post I realize that GitHub Flavored Markdown does the exact same thing. So this is more an issue than a problem ;-)

@vkbo
Copy link
Owner

vkbo commented Jun 21, 2020

This is correct behaviour. The markdown syntax is requiring a tight inclusion around a word or set of words.

The regex strings used for detecting these in novelWriter are taken from a syntax highlighter that is supposed to follow markdown standard. So I'm not surprised that GitHub behaves the same way.

A naive code that just turns the format on and off each time it sees a ~~ token is of course possible, but is also a lot slower than the current implementation, so not really an option.

@vkbo vkbo self-assigned this Jun 21, 2020
@vkbo vkbo added the not a bug Invalid: Feature, not a bug label Jun 21, 2020
@vkbo
Copy link
Owner

vkbo commented Jun 21, 2020

The RegEx actually explicitly forbids a space in that position.

FMT_ST = r"(?<![\w|~|\\])([~]{2})(?!\s|~)(.+?)(?<![\s|\\])(\1)(?!\w)"

@johnblommers
Copy link
Author

Perhaps a note about this behavior in the documentation will close this issue.

I've been using Markdown for years and was surprised by this behavior enough to make note of it here. But you are absolutely right about it. I tried it in Typora and it behaves as you describe it should.

@vkbo
Copy link
Owner

vkbo commented Jun 21, 2020

I'm pretty sure I copied the highlighting rules from the Markdown extension for either VSCode or Atom. I am not skilled enough with RegEx to write that on my own, although I have modified them a bit!

The documentation actually does show examples with no spaces, but I'll make an extra note about it.

@vkbo vkbo added the documentation Request: Changes to documentation label Jun 21, 2020
@vkbo vkbo added this to To Do (General) in Release 1.0 - Core Features Jun 21, 2020
@vkbo vkbo mentioned this issue Jun 23, 2020
@vkbo vkbo linked a pull request Jun 23, 2020 that will close this issue
@vkbo vkbo closed this as completed in #338 Jun 23, 2020
Release 1.0 - Core Features automation moved this from To Do (General) to Done Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Request: Changes to documentation not a bug Invalid: Feature, not a bug
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants