-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML Reader: Regression for figure without figcaption #4183
Comments
I'm not sure why. In the HTML page as displayed by a browser, there will be no caption. So, why should pandoc parse this as a figure with a caption? |
For the same reason this happens:
|
A better fix for the round-trip failure you point to would be making the markdown output from the first step something like
to avoid having it interpreted as an implicit figure. |
Basically all I'm saying is that wrapping an |
I changed the pull request accordingly. I guess parsing the alt text when there is no figcaption will have to wait for #3177 |
I disagree about the need for waiting for #3177 (which has been 4 years and shows no particular sign of being solved soon). Pandoc already supports the necessary construct in the form of attributes, and already correctly parses and deals with img tags with alt attributes... just only in the Markdown->HTML direction:
And of course, Pandoc even solves figures to some degree by treating it as a HTML literal... but only if you parse the HTML as Markdown, as parsing the HTML as HTML delivers worse results, erasing attributes and classes:
The HTML reader just needs to be improved to handle alt/title/class attributes on imgs, |
We could easily change the reader so that the alt was used as the caption when no caption exists. But I'm not sure this is the right way forward; it would mean that a figure without a caption became a figure with a caption after round-tripping html -> markdown -> html. |
HTML
figure
s without a correspondingfigcaption
should fall back to thealt
text of theimg
(as was the behaviour prior to #3813) rather than having no caption at all.A related issue is that
figcaption
is ignored when it contains block tags likediv
orp
:The text was updated successfully, but these errors were encountered: