Skip to content

Reparsing a node #1155

Answered by wooorm
CAYdenberg asked this question in Q&A
May 2, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Once remarkParse has passed over it, the alt text is "Bold title. Rest of caption." with no rich text markup.

This is indeed the case. That is because CommonMark prescribes it as such.
This is because images and links are parsed the same: separately, ![ and [, and then ](url) for example. Then when a ](url) matches to a ![, they together turn into an image.
That means they can include emphasis, strong, inline code, autolinks even, etcetera.
But of course: <em> doesn’t work in alt="...". Which is why CommonMark prescribes that the HTML tags are ignored.

Is there a standard approach

No, I’d instead recommend alternatives to your custom markdown flavor which are more commonly supported, …

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

Answer selected by CAYdenberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants