Reparsing a node #1155
-
I'm a bit of a n00b to unified, but it seems like this should have a straightforward answer. I am working with a flavour of markdown that (mis)uses alt text as captions. For example:
Once remarkParse has passed over it, the alt text is "Bold title. Rest of caption." with no rich text markup. Is there a standard approach (a util?) for going back to the original file so that I can select the text within the square brackets and reparse it as markdown? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Welcome @CAYdenberg!
What are you looking at?
This sounds like your proposed solution, but what is your goal? |
Beta Was this translation helpful? Give feedback.
-
This is indeed the case. That is because CommonMark prescribes it as such.
No, I’d instead recommend alternatives to your custom markdown flavor which are more commonly supported, such as generic directives: https://github.com/remarkjs/remark-directive. See also a related issue I posted on CM: commonmark/commonmark-spec#716. |
Beta Was this translation helpful? Give feedback.
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 inalt="..."
. Which is why CommonMark prescribes that the HTML tags are ignored.No, I’d instead recommend alternatives to your custom markdown flavor which are more commonly supported, …