public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* webtex generated image in Markdown does not convert to HTML
@ 2022-02-03 14:30 christophe dervieux
       [not found] ` <6b387ee2-1203-49c2-ae2c-a57eef54611dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: christophe dervieux @ 2022-02-03 14:30 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2463 bytes --]



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 happens the same with -t markdown and currently it prevent rendering 
the new markdown 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 -f gfm -t html test-webtex.md
<p><embed
src="https://latex.codecogs.com/png.latex?%0A%5Cfrac%7Bx%7D%7By%7D%0A"
title="
\frac{x}{y}
" /></p>
`

It seems the markdown reader and the gfm reader do not see the same thing 

$ 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)"
    ]
]
$ 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"
        )
    ]
]

Is the way of writing the image expected ?
Is webtex really supported for gfm only ?
Is there an extension to activate in markdown to support this the same as 
with gfm ? 

*Pandoc version?*

$ pandoc --version
pandoc 2.17.1.1

​

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6b387ee2-1203-49c2-ae2c-a57eef54611dn%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 14872 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: webtex generated image in Markdown does not convert to HTML
       [not found] ` <6b387ee2-1203-49c2-ae2c-a57eef54611dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-02-03 16:25   ` John MacFarlane
       [not found]     ` <m24k5f534k.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2022-02-03 16:25 UTC (permalink / raw)
  To: christophe dervieux, pandoc-discuss

christophe dervieux <christophe.dervieux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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 

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 "title
title
")
<p><a href="url" title="title title">a</a></p>

Submit an issue with this data?

> It seems the markdown reader and the gfm reader do not see the same thing 

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. Please submit an issue.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m24k5f534k.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: webtex generated image in Markdown does not convert to HTML
       [not found]     ` <m24k5f534k.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
@ 2022-02-03 16:51       ` christophe dervieux
  0 siblings, 0 replies; 3+ messages in thread
From: christophe dervieux @ 2022-02-03 16:51 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]

Thanks.

Issue open: https://github.com/jgm/pandoc/issues/7892

Le jeu. 3 févr. 2022 à 17:25, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> a écrit :

> christophe dervieux <christophe.dervieux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > 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
>
> 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 "title
> title
> ")
> <p><a href="url" title="title title">a</a></p>
>
> Submit an issue with this data?
>
> > It seems the markdown reader and the gfm reader do not see the same
> thing
>
> 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. Please submit an issue.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAJJMaCTKQEa9Hji7eV43bSHfbBAkc0j6KbgJb6KmUPKsGgskVA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-03 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 14:30 webtex generated image in Markdown does not convert to HTML christophe dervieux
     [not found] ` <6b387ee2-1203-49c2-ae2c-a57eef54611dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-02-03 16:25   ` John MacFarlane
     [not found]     ` <m24k5f534k.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2022-02-03 16:51       ` christophe dervieux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).