flexmark-java icon indicating copy to clipboard operation
flexmark-java copied to clipboard

Image not getting rendered in HTML

Open lamyergeier opened this issue 4 years ago • 2 comments

Background

I was redirected to post my issues here: Image not getting rendered in HTML · Issue #1547 · gsantner/markor

Description

  • Case 1: Renders Properly
# Head 1

![Title](Image/Image.png)

  • Case 2: Image is rendered and shows the text {#fig: width="1500px"} which is acceptable but undesirable
# Head 1

![Title](Image/Image.png){#fig: width="1500px"}

  • Case 3: Image is not at all rendered!
# Head 1

![Title][]

  [Title]: Image/Image.png {#fig: width="1500px"}


Request

flexmark-java does not support {#fig: width="1500px"} for images. Could you please ignore it such that image is atleast rendered in Case 3?

lamyergeier avatar Dec 29 '21 22:12 lamyergeier

If you add the Attributes extension, then {} syntax will be used for setting attributes. However, there are still limitations on the syntax. Specifically, the location of the attributes and whether there is a space between the opening { or not will determine with which element they are associated. See docs for that Attributes-Extension

For image and link refs the attributes have to go to the next line otherwise the link ref definition will not be recognized by the standard parser.

# Head 1

![Title][]

[Title]: Image/Image.png
{#fig: width="1500px"}

renders as you would expect:

<h1>Head 1</h1>
<p><img src="Image/Image.png" alt="Title" id="fig:" width="1500px" /></p>

vsch avatar Jan 24 '22 23:01 vsch

But pandoc, one of the most popular parser does

# Head 1

![Title][]

  [Title]: Image/Image.png {#fig: width="1500px"}

That is, it adds space between png and {, it does not add a newline between them. Is it possible to observe this behavior? I am requesting this as I use Pandoc on my laptop but am app uses your library on android.

lamyergeier avatar Jan 25 '22 08:01 lamyergeier