From c5f5bf4dc0bab2e19ef562b648acfc91828bd4c9 Mon Sep 17 00:00:00 2001 From: Andy Clifford Date: Wed, 11 Oct 2023 12:17:49 +1300 Subject: [PATCH] Markdoc Integration allowIndentation option Added allowIndentation to the markdoc integration options. This allows indentation of markdoc tags for better readability without allowing raw HTML in Markdoc files. --- .changeset/hip-rockets-glow.md | 5 +++ packages/integrations/markdoc/README.md | 33 +++++++++++++++ packages/integrations/markdoc/src/options.ts | 1 + .../integrations/markdoc/src/tokenizer.ts | 6 ++- .../astro.config.mjs | 7 ++++ .../markdoc.config.ts | 26 ++++++++++++ .../package.json | 12 ++++++ .../src/components/Code.astro | 12 ++++++ .../src/components/CustomMarquee.astro | 1 + .../blog/with-indented-components.mdoc | 24 +++++++++++ .../src/pages/index.astro | 19 +++++++++ .../integrations/markdoc/test/render.test.js | 42 +++++++++++++++++++ pnpm-lock.yaml | 13 ++++++ 13 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 .changeset/hip-rockets-glow.md create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/astro.config.mjs create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/markdoc.config.ts create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/package.json create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/components/Code.astro create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/components/CustomMarquee.astro create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/content/blog/with-indented-components.mdoc create mode 100644 packages/integrations/markdoc/test/fixtures/render-with-indented-components/src/pages/index.astro diff --git a/.changeset/hip-rockets-glow.md b/.changeset/hip-rockets-glow.md new file mode 100644 index 000000000..c05314d30 --- /dev/null +++ b/.changeset/hip-rockets-glow.md @@ -0,0 +1,5 @@ +--- +'@astrojs/markdoc': minor +--- + +Added allowIndentation as a markdoc integration option to enable better readability diff --git a/packages/integrations/markdoc/README.md b/packages/integrations/markdoc/README.md index da575acc2..f7db4074e 100644 --- a/packages/integrations/markdoc/README.md +++ b/packages/integrations/markdoc/README.md @@ -458,6 +458,39 @@ To achieve a more Markdown-like experience, where HTML elements can be included > **Warning** > When `allowHTML` is enabled, HTML markup inside Markdoc documents will be rendered as actual HTML elements (including `