diff --git a/.changeset/stupid-poets-grab.md b/.changeset/stupid-poets-grab.md new file mode 100644 index 000000000..47e3005e5 --- /dev/null +++ b/.changeset/stupid-poets-grab.md @@ -0,0 +1,16 @@ +--- +'@astrojs/markdoc': patch +--- + +Adds an "allowHTML" Markdoc integration option. + +When enabled, all HTML in Markdoc files will be processed, including HTML elements within Markdoc tags and nodes. + +Enable this feature in the `markdoc` integration configuration: + +```js +// astro.config.mjs +export default defineConfig({ + integrations: [markdoc({ allowHTML: true })], +}); +``` diff --git a/packages/integrations/markdoc/README.md b/packages/integrations/markdoc/README.md index 15bf24467..d9a7d15c5 100644 --- a/packages/integrations/markdoc/README.md +++ b/packages/integrations/markdoc/README.md @@ -93,7 +93,7 @@ const { Content } = await entry.render(); 📚 See the [Astro Content Collection docs][astro-content-collections] for more information. -## Configuration +## Markdoc config `@astrojs/markdoc` offers configuration options to use all of Markdoc's features and connect UI components to your content. @@ -401,6 +401,36 @@ const { Content } = await entry.render(); This can now be accessed as `$frontmatter` in your Markdoc. +## Integration config options + +The Astro Markdoc integration handles configuring Markdoc options and capabilities that are not available through the `markdoc.config.js` file. + +### allowHTML + +Enables writing HTML markup alongside Markdoc tags and nodes. + +By default, Markdoc will not recognize HTML markup as semantic content. + +To achieve a more Markdown-like experience, where HTML elements can be included alongside your content, set `allowHTML:true` as a `markdoc` integration option. This will enable HTML parsing in Markdoc markup. + + +> **Warning** +> When `allowHTML` is enabled, HTML markup inside Markdoc documents will be rendered as actual HTML elements (including `