Skip to content

Commit 4a39d39

Browse files
authored
fix(plugin-md-power): incorrect rendering heading from demo in outline, close #423 (#431)
* fix(plugin-md-power): incorrect rendering heading from `demo` in `outline`, close #423 * chore: tweak
1 parent f81c011 commit 4a39d39

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

plugins/plugin-md-power/src/node/demo/supports/compiler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export async function compileScript(source: string, type: 'ts' | 'js'): Promise<
2626
const transform = await compiler.script()
2727
const res = await transform(source, {
2828
target: 'es2018',
29+
platform: 'browser',
2930
format: 'cjs',
3031
loader: type === 'ts' ? 'ts' : 'js',
3132
sourcemap: false,

theme/src/client/composables/outline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function useHeaders(): Ref<MenuItem[]> {
7272

7373
export function getHeaders(range?: ThemeOutline): MenuItem[] {
7474
const headers = Array.from(
75-
document.querySelectorAll('.vp-doc :where(h1,h2,h3,h4,h5,h6)'),
75+
document.querySelectorAll('.vp-doc :where(h1,h2,h3,h4,h5,h6):not(.vp-demo-wrapper :where(h1,h2,h3,h4,h5,h6))'),
7676
)
7777
.filter(el => el.id && el.hasChildNodes())
7878
.map((el) => {

0 commit comments

Comments
 (0)