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

Backslash in block quotes causes errors #495

Closed
Witiko opened this issue Sep 6, 2024 Discussed in #494 · 2 comments · Fixed by #496
Closed

Backslash in block quotes causes errors #495

Witiko opened this issue Sep 6, 2024 Discussed in #494 · 2 comments · Fixed by #496
Labels
bug defaults Related to default option values and renderer prototypes lua Related to the Lua interface and implementation plaintex Related to the plain TeX interface and implementation
Milestone

Comments

@Witiko
Copy link
Owner

Witiko commented Sep 6, 2024

Discussed in #494

Originally posted by l0th3r September 6, 2024
Hi,
I am new to Tex and LaTex.

@Witiko let me know if this should be in issues instead of here.
When using backslash for new line in a block quote, it causes long series of errors.

Test tex file:

\documentclass{article}
\usepackage{markdown}

\begin{document}
\begin{markdown}
> **TITLE** \
> Lorem ipsum dolor sit amet
\end{markdown}
\end{document}

Thank you in advance for your time and help.

@Witiko Witiko added bug lua Related to the Lua interface and implementation plaintex Related to the plain TeX interface and implementation labels Sep 6, 2024
@Witiko Witiko added this to the 3.7.1 milestone Sep 6, 2024
Witiko added a commit that referenced this issue Sep 6, 2024
@Witiko Witiko added the defaults Related to default option values and renderer prototypes label Sep 6, 2024
@Witiko
Copy link
Owner Author

Witiko commented Sep 6, 2024

@Witiko let me know if this should be in issues instead of here.

It should, I just transferred it.

When using backslash for new line in a block quote, it causes long series of errors.

Converting he above code with the Markdown package 3.7.0 produces the following TeX code:

\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
\markdownRendererStrongEmphasis{TITLE}\markdownRendererError{parse_inlines_no_link_or_emphasis failed on:
 \markdownRendererBackslash{}
> Lorem ipsum dol}\markdownRendererBlockQuoteEnd

There are two issues here:

  1. We fail to parse a completely valid Markdown input. I added a regression test in commit 86efd5c from draft PR #496.

  2. \markdownRendererError chokes on the error text, since it incorrectly calls \markdownError. Here is the necessary change of file kpsewhich markdownthemewitiko_markdown_defaults.tex:

    170c170
    < \let\markdownRendererErrorPrototype\markdownError
    ---
    > \def\markdownRendererErrorPrototype#1{\markdownError{#1}{}}

    After this change, compiling the above code produces this more informative error message:

    ! Package markdown Error: parse_inlines_no_link_or_emphasis failed on:
    (markdown)                \TU\textbackslash {} > Lorem
    (markdown)                ipsum dol
    

    There are other changes that should be done. For example, the parameter of \markdownRendererError should be only minimally escaped, allowing a more readable error message:

    ! Package markdown Error: parse_inlines_no_link_or_emphasis failed on: \ >
    (markdown)                Lorem ipsum dol
    

    Alternatively and perhaps more appropriately, the default renderer prototype should redefine the special symbol renderers and expand the message text before logging it.

Witiko added a commit that referenced this issue Sep 6, 2024
Witiko added a commit that referenced this issue Sep 6, 2024
Witiko added a commit that referenced this issue Sep 6, 2024
@Witiko
Copy link
Owner Author

Witiko commented Sep 19, 2024

There are two issues here:

  1. We fail to parse a completely valid Markdown input. I added a regression test in commit 86efd5c from draft PR #496.

@l0th3r: This has been fixed in commit 322f91f from PR #495. I should have #495 merged next Monday. However you should be able to patch your copy of file markdown-parser.lua right now based just on 322f91f. Early feedback welcome.

Witiko added a commit that referenced this issue Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug defaults Related to default option values and renderer prototypes lua Related to the Lua interface and implementation plaintex Related to the plain TeX interface and implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant