diff --git a/src/print/doc-helpers.ts b/src/print/doc-helpers.ts index fa6ed4d0..c54cc77a 100644 --- a/src/print/doc-helpers.ts +++ b/src/print/doc-helpers.ts @@ -94,7 +94,12 @@ export function trimRight(group: Doc[], isWhitespace: (doc: Doc) => boolean): Do } function getParts(doc: Doc): Doc[] | undefined { - if (typeof doc === 'object' && (doc.type === 'fill' || doc.type === 'concat')) { - return doc.parts; + if (typeof doc === 'object') { + if (doc.type === 'fill' || doc.type === 'concat') { + return doc.parts; + } + if (doc.type === 'group') { + return getParts(doc.contents); + } } } diff --git a/test/printer/samples/markdown.md b/test/printer/samples/markdown.md index c7ba83e0..31ee27f0 100644 --- a/test/printer/samples/markdown.md +++ b/test/printer/samples/markdown.md @@ -17,5 +17,32 @@ by offloading the formatting of the fenced code block to prettier-plugin-svelte. color: green; } +``` + +```svelte + +``` +```svelte +