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 at start of line #50

Closed
tmistele opened this issue Nov 2, 2022 · 0 comments
Closed

Backslash at start of line #50

tmistele opened this issue Nov 2, 2022 · 0 comments

Comments

@tmistele
Copy link

tmistele commented Nov 2, 2022

For this .md file

$ cat my-test.md
x = \frac12
\frac12 = x

only the first line is correctly recovered by stupicat.
The second one gets a spurious backslash

$ cargo run -q --example stupicat -- my-test.md
x = \frac12
\\frac12 = x

This always seems to happen when the backslash is at the start of a line.

pulldown-cmark -e looks good to me

$ pulldown-cmark -e < my-test.md
0..24: Start(Paragraph)
0..11: Text(Borrowed("x = \\frac12"))
11..12: SoftBreak
12..23: Text(Borrowed("\\frac12 = x"))
0..24: End(Paragraph)
EOF

So I guess the issue is with pulldown-cmark-to-cmark?

Edit: I now realized \frac12 = x and \\frac12 = x are equivalent as far as commonmark is concerned. So there's not really a problem here. I was trying to use the output of pulldown-cmark-to-cmark as input for a markdown parser that supports math. With the above example, the additional backslash then distorted the math rendering. But while this particular issue might be fixed by not adding an additional backslash, this would just lead to other cases where math is not rendered as intended (e.g. explicit latex line breaks \\ at the start of a line in a .md file?). So I'm closing this for now. A proper fix will probably have to wait until pulldown-cmark/pulldown-cmark#6 is resolved.

@tmistele tmistele closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant