Skip to content

Commit 5fe8ee6

Browse files
committed
fix(twoslash): nested code block rendering structure
fix twoslashes/twoslash#38
1 parent ae470d5 commit 5fe8ee6

File tree

11 files changed

+6866
-6177
lines changed

11 files changed

+6866
-6177
lines changed

docs/components.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable */
2-
/* prettier-ignore */
32
// @ts-nocheck
43
// Generated by unplugin-vue-components
54
// Read more: https://github.com/vuejs/core/pull/3399
65
export {}
76

7+
/* prettier-ignore */
88
declare module 'vue' {
99
export interface GlobalComponents {
1010
Badges: typeof import('./.vitepress/components/Badges.vue')['default']

packages/twoslash/src/renderer-rich.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export function rendererRich(options: RendererRichOptions = {}): TwoslashRendere
235235
lang: (this.options.lang === 'tsx' || this.options.lang === 'jsx')
236236
? 'tsx'
237237
: 'ts',
238-
structure: 'inline',
238+
structure: content.trim().includes('\n') ? 'classic' : 'inline',
239239
},
240240
).children as ElementContent[],
241241
}

packages/twoslash/test/out/completion-end-multifile.ts.html

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)