#How can we substitute a string in markdown with another string surrounded by HTML tags?

3 messages · Page 1 of 1 (latest)

bitter lily
#

I'm trying to subsitute 'CO2' with 'CO<sub>2</sub> using unified. The problem is that the brackets are encoded such that they appear as brackets in the final HTML. How can we do that kind of substitution in astro.config.mjs?

real mistBOT
#

Hi @bitter lily. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. The provided knowledge sources do not contain specific information on how to substitute a string in markdown with another string surrounded by HTML tags using unified in the astro.config.mjs file.

However, Astro does support HTML in markdown files. For instance, the Astro Markdoc integration allows writing HTML markup alongside Markdoc tags and nodes by setting allowHTML:true as a markdoc integration option. This will enable HTML parsing in Markdoc markup. But please be aware that when allowHTML is enabled, HTML markup inside Markdoc documents will be rendered as actual HTML elements, making attack vectors like XSS possible. Ensure that any HTML markup comes from trusted sources. source (https://docs.astro.build/en/guides/integrations-guide/markdoc/#integration-config-options)

For more specific information on how to achieve your goal, I would recommend checking the Astro documentation (https://docs.astro.build/) or the unified documentation (https://unifiedjs.com/).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: