-
What I want is for marked to turn a string, for example: testing **image** ![test](...) Into the following: testing **image** <img href="..." alt="test" /> Where it only converts the image portion of the string into an HTML tag. (As I would like to replace what is in As opposed to it currently doing: <p>testing <strong>image</strong> <img href="..." alt="test"/></p> Is there a way to do this, or will I have to let it convert everything in the string to HTML tags? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Do you want to change the href in the middle of marked outputting html? In that case I would use use walkTokens to look for link tokens and update the href accordingly. If you actually only want link tokens to generate html, you can update all other renderers to just output the raw text instead of html. const renderer = {
heading(token) {
return token.raw;
},
...
} |
Beta Was this translation helpful? Give feedback.
Do you want to change the href in the middle of marked outputting html? In that case I would use use walkTokens to look for link tokens and update the href accordingly.
If you actually only want link tokens to generate html, you can update all other renderers to just output the raw text instead of html.