Add support for implicit figures for images #102

Open
opened 2026-01-29 14:26:48 +00:00 by claunia · 3 comments
Owner

Originally created by @RickStrahl on GitHub (Mar 14, 2017).

I'm using builder.UseFigures() in my pipeline builder code, but I don't see figure output rendered.

Example here:
https://babelmark.github.io/?text=!%5BSave+Image+to+Azure+Blob+Storage+Addin%5D(https%3A%2F%2Fgithub.com%2FRickStrahl%2FSaveToAzureBlob-MarkdownMonster-Addin%2Fraw%2Fmaster%2FSaveToAzureMarkdownMonsterAddin.gif)%0A

Markdig renders the image only which seems like Figures is not doing anything. Pandoc renders with figure classes, multi-markdown uses figure proper figure/figcaption elements.

Looks like MarkDig should render figure/figurecaption, but I don't see it rendered. Double checked to make sure FigureExtension is loaded in the final PipelineBuilder used to render with:

Markdown.Convert(markdown, renderer, Pipeline);

BTW, how does the Markdig Parser run in BabelMark? With all options enabled?

Originally created by @RickStrahl on GitHub (Mar 14, 2017). I'm using `builder.UseFigures()` in my pipeline builder code, but I don't see figure output rendered. Example here: https://babelmark.github.io/?text=!%5BSave+Image+to+Azure+Blob+Storage+Addin%5D(https%3A%2F%2Fgithub.com%2FRickStrahl%2FSaveToAzureBlob-MarkdownMonster-Addin%2Fraw%2Fmaster%2FSaveToAzureMarkdownMonsterAddin.gif)%0A Markdig renders the image only which seems like Figures is not doing anything. Pandoc renders with figure classes, multi-markdown uses figure proper figure/figcaption elements. Looks like MarkDig should render figure/figurecaption, but I don't see it rendered. Double checked to make sure FigureExtension is loaded in the final PipelineBuilder used to render with: ```csharp Markdown.Convert(markdown, renderer, Pipeline); ``` BTW, how does the Markdig Parser run in BabelMark? With all options enabled?
claunia added the enhancementPR Welcome! labels 2026-01-29 14:26:48 +00:00
Author
Owner

@xoofx commented on GitHub (Mar 15, 2017):

Afair, The figure extension is not doing anything with regular image links. As described on CommonMark forum, I implemented the following:

^^^
This is a text
> With a block quote and an ![image](/url "my title")
^^^ My caption

The ^^^ identifies a figure block with a block caption and renders like this:

<figure>
  <p>This is a text</p>
  <blockquote><p>With a block quote and an <img src="/url" alt="image" title="my title"><p>
  </blockquote>
  <figcaption>My caption</figcaption>
</figure>

In this discussion, they talked about implementing something automatically for img, but It was not settled and I prefer to have an explicit figure caption (and not automatically generated)

^^^
![Kookburra](/kookaburra.jpg "Kookburra")
![Pelican](/pelican.jpg "Pelican")
![Cheeky looking Rainbow Lorikeet](/lorikeet.jpg "Rainbow Lorikeet")
^^^ From left to right, Kookburra, Pelican, and Rainbow Lorikeet.

should render like this (check markdig advanced on babelmark):

<figure>
   <p>
  <img src="/kookaburra.jpg" alt="Kooaburra" title="Kookburra">
  <img src="/pelican.jpg" alt="Pelican stood on the beach" title="Pelican">
  <img src="/lorikeet.jpg" alt="Cheeky looking Rainbow Lorikeet" title="Rainbow Lorikeet">
  </p>
  <figcaption>From left to right, Kookburra, Pelican, and Rainbow Lorikeet.</figcaption>
</figure>

BTW, how does the Markdig Parser run in BabelMark? With all options enabled?

@xoofx commented on GitHub (Mar 15, 2017): Afair, The figure extension is not doing anything with regular image links. As described on [CommonMark forum](https://talk.commonmark.org/t/image-tag-should-expand-to-figure-when-used-with-title/265/7), I implemented the following: ``` ^^^ This is a text > With a block quote and an ![image](/url "my title") ^^^ My caption ```` The `^^^` identifies a figure block with a block caption and renders like this: ```html <figure> <p>This is a text</p> <blockquote><p>With a block quote and an <img src="/url" alt="image" title="my title"><p> </blockquote> <figcaption>My caption</figcaption> </figure> ``` In this discussion, they talked about implementing something automatically for img, but It was not settled and I prefer to have an explicit figure caption (and not automatically generated) ``` ^^^ ![Kookburra](/kookaburra.jpg "Kookburra") ![Pelican](/pelican.jpg "Pelican") ![Cheeky looking Rainbow Lorikeet](/lorikeet.jpg "Rainbow Lorikeet") ^^^ From left to right, Kookburra, Pelican, and Rainbow Lorikeet. ``` should render like this (check [markdig advanced on babelmark](https://babelmark.github.io/?text=%5E%5E%5E%0A!%5BKookburra%5D(%2Fkookaburra.jpg+%22Kookburra%22)%0A!%5BPelican%5D(%2Fpelican.jpg+%22Pelican%22)%0A!%5BCheeky+looking+Rainbow+Lorikeet%5D(%2Florikeet.jpg+%22Rainbow+Lorikeet%22)%0A%5E%5E%5E+From+left+to+right%2C+Kookburra%2C+Pelican%2C+and+Rainbow+Lorikeet.)): ```html <figure> <p> <img src="/kookaburra.jpg" alt="Kooaburra" title="Kookburra"> <img src="/pelican.jpg" alt="Pelican stood on the beach" title="Pelican"> <img src="/lorikeet.jpg" alt="Cheeky looking Rainbow Lorikeet" title="Rainbow Lorikeet"> </p> <figcaption>From left to right, Kookburra, Pelican, and Rainbow Lorikeet.</figcaption> </figure> ``` > BTW, how does the Markdig Parser run in BabelMark? With all options enabled? - **markdig**: no options, plain common mark - **markdig (advanced)**: [advanced plugins list](https://github.com/lunet-io/markdig/blob/151acf54a75c70622e4dca1376aa11b35420f90c/src/Markdig/MarkdownExtensions.cs#L58)
Author
Owner

@RickStrahl commented on GitHub (Mar 17, 2017):

Yeah I kind of agree about the explicit nature. PanDoc however does render figure captions (using styling rather than figure/figcaption tho)...

Thanks for the clarification.

@RickStrahl commented on GitHub (Mar 17, 2017): Yeah I kind of agree about the explicit nature. PanDoc however does render figure captions (using styling rather than figure/figcaption tho)... Thanks for the clarification.
Author
Owner

@xoofx commented on GitHub (Mar 17, 2017):

PanDoc however does render figure captions (using styling rather than figure/figcaption tho)...

Reopening and mark it as an enhancement. Implicit figure for image is something that can be done as part of the figure extension (through no spare time to work on this)

@xoofx commented on GitHub (Mar 17, 2017): > PanDoc however does render figure captions (using styling rather than figure/figcaption tho)... Reopening and mark it as an enhancement. Implicit figure for image is something that can be done as part of the figure extension (through no spare time to work on this)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#102