Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/pandocPublic

webtex generated image in Markdown does not convert to HTML due to newline #7892

Closed
Labels
@cderv

Description

@cderv

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![\\frac{x}{y}](https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A"\frac{x}{y}")

There is some new line inserted inside what should be an image link in markdown. I was expecting this![\\frac{x}{y}](https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A "\frac{x}{y}")

This creates issues when trying to convert to HTML

$ pandoc -t markdown --webtex -o test-webtex.md test.md$ ​cat test-webtex.md![\\frac{x}{y}](https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A"\frac{x}{y}")$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:

  1. fix markdown reader so it's okay with the line break after "
    in title.

  2. fix writer so it strips out the leading and trailing space of
    a title.

Probably worth doing both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp