From a5334733256e11b827c72905a7b06b636f20d455 Mon Sep 17 00:00:00 2001 From: Andy Clifford Date: Thu, 12 Oct 2023 13:11:22 +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 | 34 +++++++++++++++ packages/integrations/markdoc/src/options.ts | 1 + .../integrations/markdoc/src/tokenizer.ts | 6 ++- .../astro.config.mjs | 7 ++++ .../markdoc.config.ts | 26 ++++++++++++ .../package.json | 9 ++++ .../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 | 9 ++++ 13 files changed, 194 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 0000000000000..c05314d30b0b8 --- /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 da575acc226f2..8fc9d057c6487 100644 --- a/packages/integrations/markdoc/README.md +++ b/packages/integrations/markdoc/README.md @@ -458,6 +458,40 @@ 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 `