Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.6k
Description
Fromhttps://groups.google.com/g/pandoc-discuss/c/rRAh4z3l_BY
Take this md document
$echo -e'$$\n\\frac{x}{y}\n$$'> test.md$ cat test.md$$\frac{x}{y}$$
It can be converted using webtex in Markdown to use an image
$ pandoc -t gfm --webtex test.md
There is some new line inserted inside what should be an image link in markdown. I was expecting this
This creates issues when trying to convert to HTML
$ pandoc -t markdown --webtex -o test-webtex.md test.md$ cat test-webtex.md$pandoc -f markdown -t html test-webtex.md<p>[\frac{x}{y}](https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A” “)</p>```$ pandoc -t native -f markdown test-webtex.md[ Para [ Str"[" , SoftBreak , Str "\\frac{x}{y}](https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A" , Space , Str"\8221" , SoftBreak , RawInline (Format"tex")"\\frac{x}{y}" , SoftBreak , Str"\8220)" ]]
From@jgm
Looks like the parser expects a non-space character after the
opening " in a link/image title. So we should avoid a break
there.
BAD:
% pandoc[a](url "title")<p>[ a](url ” title “)</p>
OK:
% pandoc[a](url "titletitle")<p><a href="url" title="title title">a</a></p>
With gfm reader it does not see the same thing
$ pandoc -t native -f gfm test-webtex.md[ Para [ Image ("" , [] , [] ) [ SoftBreak , Str"\\frac{x}{y}" , SoftBreak ] ("https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A" ,"\n\\frac{x}{y}\n" ) ]]
From@jgm
gfm reader is commonmark and uses a different parser, which
doesn't mind the line break there.
So there are two possible solutions:
fix markdown reader so it's okay with the line break after "
in title.fix writer so it strips out the leading and trailing space of
a title.
Probably worth doing both.