Files
John MacFarlane 2155b5f9bc Markdown writer: render a figure with Para caption as implicit figure.
Also, when falling back to a Div with class `figure` for a figure
that can't be represented any other way, include a Div with class
`caption` containing the caption.

Closes #10755.
2025-04-04 10:16:23 -07:00

1.3 KiB

% pandoc -f native -t markdown
[ Figure
    ( "" , [] , [] )
    (Caption
       Nothing [ Para [ Str "An" , Space , Str "image." ] ])
    [ Plain
        [ Image
            ( ""
            , []
            , []
            )
            [ Str "An" , Space , Str "image." ]
            ( "media/rId20.jpg" , "" )
        ]
    ]
]
^D
![An image.](media/rId20.jpg)
% pandoc -f native -t markdown -t markdown-implicit_figures
[ Figure
    ( "" , [] , [] )
    (Caption
       Nothing [ Para [ Str "An" , Space , Str "image." ] ])
    [ Plain
        [ Image
            ( ""
            , []
            , []
            )
            [ Str "An" , Space , Str "image." ]
            ( "media/rId20.jpg" , "" )
        ]
    ]
]
^D
<figure>
<img src="media/rId20.jpg" alt="An image." />
<figcaption aria-hidden="true"><p>An image.</p></figcaption>
</figure>
% pandoc -f native -t markdown -t markdown-implicit_figures-raw_html
[ Figure
    ( "" , [] , [] )
    (Caption
       Nothing [ Para [ Str "An" , Space , Str "image." ] ])
    [ Plain
        [ Image
            ( ""
            , []
            , []
            )
            [ Str "An" , Space , Str "image." ]
            ( "media/rId20.jpg" , "" )
        ]
    ]
]
^D
:::: figure
![An image.](media/rId20.jpg)

::: caption
An image.
:::
::::