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

Viewer renders escaped markdown syntax, Builder renders the backslash instead #1412

Closed
tmarplatt opened this issue Apr 9, 2023 · 5 comments · Fixed by #1418
Closed

Viewer renders escaped markdown syntax, Builder renders the backslash instead #1412

tmarplatt opened this issue Apr 9, 2023 · 5 comments · Fixed by #1418
Assignees
Labels
bug Issue: Something isn't working
Milestone

Comments

@tmarplatt
Copy link
Contributor

The problem

When you escape Markdown syntax using backslash \, as you would in other editors, the Viewer does indeed render the document as expected by intuition:

nwviewer

If you try to render the project, the Builder will both preview it and build it without parsing the escape code, rendering a backslash instead.

nwbuilder

The expectation

There may not be a bug here but this behaviour appears inconsistent. I'm not sure if escaping is meant to be a novelWriter feature but I hope it is.

In the event of an unfortunate coincidence in text, the author may need to be able to escape Markdown syntax. I actually met this unfortunate coincidence myself with a double asterisk repeating in the same paragraph.

@tmarplatt tmarplatt added the bug Issue: Something isn't working label Apr 9, 2023
@vkbo
Copy link
Owner

vkbo commented Apr 9, 2023

No, that's a bug. The renderer for the build preview and the document viewer is the same one, but the stripping of escaped characters is a separate step that must be called explicitly in the process. It should be called on some formats, like HTML and OpenDocument, and not on others like Markdown. There is probably an if-statement either missing or misconfigured somewhere in there.

@vkbo
Copy link
Owner

vkbo commented Apr 15, 2023

The issue turned out to be that the stripping of escapes after formatting parsing was done after the generated output was added to the document buffer. The buffer is what is used in the build tool, but the document viewer doesn't use this buffer as it is just a single page, hence it was working in the viewer.

In #1418 I'm just changing where this is done so that it is handled on the paragraph level.

Edit: I'll make a new release tomorrow if I have the time. There are a bunch of small fixes that needs to be released.

@tmarplatt
Copy link
Contributor Author

To be thorough:

I'm not sure if escaping is meant to be a novelWriter feature but I hope it is.

The reason for that uncertainty is because I could not find anywhere on the docs something to clear this up. Is there a thread to discuss the nW manual contents?

@vkbo
Copy link
Owner

vkbo commented Apr 22, 2023

Ah, right. I'll add a note about it. You can just open a regular ticket about it if you find anything, but I happen to have a PR in progress with some documentation changes, so I added a Tip to the "Text Emphasis" section of the "Formatting Your Text" page.

image

Not sure when I'll push it out to the live docs, as I want to go through a few things, but it has been added to the source at least.

@tmarplatt
Copy link
Contributor Author

It looks great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue: Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants