Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-md-power): incorrect rendering heading from demo in outline, close #423 #431

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/plugin-md-power/src/node/demo/supports/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function compileScript(source: string, type: 'ts' | 'js'): Promise<
const transform = await compiler.script()
const res = await transform(source, {
target: 'es2018',
platform: 'browser',
format: 'cjs',
loader: type === 'ts' ? 'ts' : 'js',
sourcemap: false,
Expand Down
2 changes: 1 addition & 1 deletion theme/src/client/composables/outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function useHeaders(): Ref<MenuItem[]> {

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