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

With the hybrid option enabled, a backslash at the end of a document breaks the conversion of the last paragraph #502

Closed
Witiko opened this issue Sep 20, 2024 · 0 comments · Fixed by #503
Assignees
Labels
bug conversion output Related to the output format of the Markdown-to-TeX conversion lua Related to the Lua interface and implementation
Milestone

Comments

@Witiko
Copy link
Owner

Witiko commented Sep 20, 2024

With the hybrid option disabled, a backslash (\) at the end of a document produces the command \markdownRendererBackslash, as expected:

$ docker run --rm -i witiko/markdown markdown-cli hybrid=false <<< 'foo \'$'\n''bar \'
\markdownRendererDocumentBegin
foo\markdownRendererHardLineBreak
{}bar \markdownRendererBackslash{}\markdownRendererDocumentEnd
$ docker run --rm -i witiko/markdown markdown-cli hybrid=false <<< 'foo'$'\n\n''bar \'
\markdownRendererDocumentBegin
foo\markdownRendererParagraphSeparator
{}bar \markdownRendererBackslash{}\markdownRendererDocumentEnd

With the hybrid option enabled, a backslash (\) at the end of a document should produce a literal backslash:

\markdownRendererDocumentBegin
foo\markdownRendererHardLineBreak
{}bar \\markdownRendererDocumentEnd
\markdownRendererDocumentBegin
foo\markdownRendererParagraphSeparator
{}bar \\markdownRendererDocumentEnd

However, it produces the following output instead:

$ docker run --rm -i witiko/markdown markdown-cli hybrid=true  <<< 'foo \'$'\n''bar \'
\markdownRendererDocumentBegin
nil\markdownRendererDocumentEnd
$ docker run --rm -i witiko/markdown markdown-cli hybrid=true  <<< 'foo'$'\n\n''bar \'
\markdownRendererDocumentBegin
foo\markdownRendererDocumentEnd

As you can see, with the hybrid option enabled, a backslash at the end of a document breaks the conversion of the whole last paragraph, potentially replacing the paragraph with the text nil.

@Witiko Witiko added bug lua Related to the Lua interface and implementation conversion output Related to the output format of the Markdown-to-TeX conversion labels Sep 20, 2024
@Witiko Witiko added this to the 3.7.1 milestone Sep 20, 2024
@Witiko Witiko changed the title With the hybrid option enabled, a backslash at the end of a document breaks the conversion With the hybrid option enabled, a backslash at the end of a document breaks the conversion of the last paragraph Sep 20, 2024
Witiko added a commit that referenced this issue Sep 20, 2024
Witiko added a commit that referenced this issue Sep 20, 2024
Witiko added a commit that referenced this issue Sep 20, 2024
@Witiko Witiko modified the milestones: 3.7.1, 3.8.0 Sep 30, 2024
@Witiko Witiko modified the milestones: 3.8.0, 3.8.1 Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug conversion output Related to the output format of the Markdown-to-TeX conversion lua Related to the Lua interface and implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants