Skip to content

Commit

Permalink
feat(theme): use v-html in VPDocFooter (#1580)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Nov 4, 2022
1 parent 124158e commit 9d10b1d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions examples/configured/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ export default defineConfig({
}
]
},
{
text: '& &#60;Text Literals &> <code>code</code>',
items: [
{
text: '& &#60;Test Page &> <code>code</code>',
link: '/text-literals/'
}
]
},
{
text: 'Static Data',
items: [
Expand Down
1 change: 1 addition & 0 deletions examples/configured/__test__/multisidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('test multi sidebar sort root', () => {
const sidebarContent = await sidebarLocator.allTextContents()
expect(sidebarContent).toEqual([
'Frontmatter',
'& <Text Literals &> code',
'Static Data',
'Multi Sidebar Test'
])
Expand Down
5 changes: 5 additions & 0 deletions examples/configured/text-literals/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Text Literals
---

# Text Literals Test
8 changes: 4 additions & 4 deletions src/client/theme-default/components/VPDocFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ const showFooter = computed(() => {
<div v-if="control.prev || control.next" class="prev-next">
<div class="pager">
<a v-if="control.prev" class="pager-link prev" :href="normalizeLink(control.prev.link)">
<span class="desc">{{ theme.docFooter?.prev ?? 'Previous page' }}</span>
<span class="title">{{ control.prev.text }} </span>
<span class="desc" v-html="theme.docFooter?.prev ?? 'Previous page'"></span>
<span class="title" v-html="control.prev.text"></span>
</a>
</div>
<div class="pager" :class="{ 'has-prev': control.prev }">
<a v-if="control.next" class="pager-link next" :href="normalizeLink(control.next.link)">
<span class="desc">{{ theme.docFooter?.next ?? 'Next page' }}</span>
<span class="title">{{ control.next.text }}</span>
<span class="desc" v-html="theme.docFooter?.next ?? 'Next page'"></span>
<span class="title" v-html="control.next.text"></span>
</a>
</div>
</div>
Expand Down

0 comments on commit 9d10b1d

Please sign in to comment.