Skip to content

From HTML to Markdown. How to get rid of HTML attributes and raw HTML code, but preserve comments #9324

Closed Answered by jgm
johnn2025 asked this question in Q&A
Discussion options

You must be logged in to vote

If you don't the {=html} raw attributes, then just specify -t markdown-raw_attribute.

As for the figure, there is currently no syntax in pandoc markdown for a figure that contains anything other than a single image. So we fall back to raw HTML.

You can disable that too: -t markdown-raw_attribute-raw_html - and then you'll get

::: {.figure .wp-block-pullquote}
> The person who says he knows what he thinks but cannot express it
> usually does not know what he thinks.
>
> Mortimer Adler
:::

but then you won't get the HTML comment at all.

So to get everything you want, you'll need to:

  • use -f markdown-raw_attribute
  • create a small filter that matches a Figure element whose contents are a Bloc…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by johnn2025
Comment options

You must be logged in to vote
1 reply
@jgm
Comment options

jgm Jan 10, 2024
Maintainer

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants