diff options
author | 2023-10-24 20:40:54 +1300 | |
---|---|---|
committer | 2023-10-24 08:40:54 +0100 | |
commit | 73b8d60f8c3eeae74035202b0ea0d4848e736c7d (patch) | |
tree | fd39ece28ab7ac3df82e37b2d11c37874d0ce57f /packages/integrations/markdoc/src/tokenizer.ts | |
parent | 341ef6578528a00f89bf6da5e4243b0fde272816 (diff) | |
download | astro-73b8d60f8c3eeae74035202b0ea0d4848e736c7d.tar.gz astro-73b8d60f8c3eeae74035202b0ea0d4848e736c7d.tar.zst astro-73b8d60f8c3eeae74035202b0ea0d4848e736c7d.zip |
feat(markdoc): allowIndentation integration option (#8802)
Diffstat (limited to 'packages/integrations/markdoc/src/tokenizer.ts')
-rw-r--r-- | packages/integrations/markdoc/src/tokenizer.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/integrations/markdoc/src/tokenizer.ts b/packages/integrations/markdoc/src/tokenizer.ts index 02719b363..79d0d7358 100644 --- a/packages/integrations/markdoc/src/tokenizer.ts +++ b/packages/integrations/markdoc/src/tokenizer.ts @@ -15,11 +15,15 @@ export function getMarkdocTokenizer(options: MarkdocIntegrationOptions | undefin }; if (options?.allowHTML) { - // we want to allow indentation for Markdoc tags that are interleaved inside HTML block elements + // allow indentation for Markdoc tags that are interleaved inside HTML block elements tokenizerOptions.allowIndentation = true; // enable HTML token detection in markdown-it tokenizerOptions.html = true; } + if (options?.ignoreIndentation) { + // allow indentation so nested Markdoc tags can be formatted for better readability + tokenizerOptions.allowIndentation = true; + } _cachedMarkdocTokenizers[key] = new Markdoc.Tokenizer(tokenizerOptions); } |