Skip to content

Commit 62c0732

Browse files
committed
doc: update doc layout
1 parent bd05fda commit 62c0732

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

site/src/components/DemoBox.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,14 @@ export default defineComponent({
142142
const docHtml = computed(() =>
143143
props.jsfiddle && props.jsfiddle.docHtml
144144
? (
145-
props.jsfiddle.docHtml
146-
.replace('<h2 id="zh-CN">zh-CN</h2>', '')
147-
.split('<h2 id="en-US">en-US</h2>')[globalConfig.isZhCN.value ? 0 : 1] || ''
145+
props.jsfiddle.docHtml.replace(
146+
`<h2 id="zh-CN">zh-CN <a class="header-anchor" href="#zh-CN">
147+
<span aria-hidden="true" class="anchor">#</span>
148+
</a></h2>`,
149+
'',
150+
).split(`<h2 id="en-US">en-US <a class="header-anchor" href="#en-US">
151+
<span aria-hidden="true" class="anchor">#</span>
152+
</a></h2>`)[globalConfig.isZhCN.value ? 0 : 1] || ''
148153
).trim()
149154
: '',
150155
);

site/src/layouts/Demo.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export default defineComponent({
3434
return props?.pageData?.html || '';
3535
});
3636
const description = computed(() => {
37-
return docHtml.value.split('<h2 id="API">API</h2>')[0];
37+
return docHtml.value.split('<h2 id="API">API <a class="header-anchor" href="#API">')[0];
3838
});
3939
const api = computed(() => {
4040
return `
4141
<h2 id="API"><span>API</span><a href="#API" class="anchor">#</a></h2>
42-
${docHtml.value.split('<h2 id="API">API</h2>')[1]}
42+
${docHtml.value.split('<h2 id="API">API <a class="header-anchor" href="#API">')[1]}
4343
`;
4444
});
45-
return { frontmatter, description, api, route, showAd };
45+
return { frontmatter, description, api, route, showAd, docHtml };
4646
},
4747
});
4848
</script>

0 commit comments

Comments
 (0)