Skip to content

Commit 8cc876c

Browse files
Merge pull request #85 from geoadmin/bugfix-PB-2088-end-of-life-preview
PB-2088: add markdown support for previewTitle and previewContent
2 parents be01d6e + 0cee191 commit 8cc876c

6 files changed

Lines changed: 1036 additions & 1277 deletions

File tree

.vitepress/theme/custom.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ figcaption {
6565
margin-top: 24px;
6666
}
6767

68+
.home-status-container p {
69+
display: inline;
70+
margin: 0px;
71+
}
72+
6873
.home-status-container a {
6974
text-decoration: none;
7075
color: var(--vp-button-brand-bg);
@@ -110,6 +115,10 @@ figcaption {
110115
margin-bottom: 4px;
111116
}
112117

118+
.home-container-col span p {
119+
margin: 0px;
120+
}
121+
113122
.home-container-col a {
114123
display: block;
115124
text-decoration: none;

components/StatusBanner.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
22
interface StatusBannerProps {
33
type: string
4-
title: string
5-
content: string
4+
previewTitle: string
5+
previewContent: string
66
}
77
88
const props = defineProps<{
@@ -18,8 +18,8 @@ const isWarning = props.status.type === 'warning'
1818
class="status-content"
1919
>
2020
<p>
21-
<span class="status-content-title">{{ props.status.title }} - </span>
22-
<span class="status-content-text">{{ props.status.content }}</span>
21+
<span class="status-content-title">{{ props.status.previewTitle }} - </span>
22+
<span class="status-content-text">{{ props.status.previewContent }}</span>
2323
</p>
2424
</a>
2525
</div>

index.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,14 @@ import { data as status } from './scripts/status.data.ts'
4646
import { data as announcements } from './scripts/announcements.data.ts'
4747
import StatusBanner from './components/StatusBanner.vue'
4848
import {withBase} from 'vitepress'
49+
// Though vitepress uses markdown-it, it's not exposed so we need to explicitly import
50+
import markdownit from 'markdown-it'
51+
4952

5053
const lastRelease = releases.at(0)
5154
const statusPreview = status[0]
5255
const announcementsPreview = announcements[0]
56+
const md = markdownit()
5357

5458

5559
let statusContainer = null;
@@ -108,13 +112,13 @@ onUnmounted(() => {
108112
<div class="announcements-container">
109113
<h2 id="home-container-h2">End-of-Life</h2>
110114
<div class="home-container-col">
111-
<h4>{{ announcementsPreview.frontmatter.previewTitle}}</h4>
112-
<span>{{ announcementsPreview.frontmatter.previewContent}}</span>
115+
<h4>{{announcementsPreview.frontmatter.previewTitle}}</h4>
116+
<span v-html="md.render(announcementsPreview.frontmatter.previewContent)"></span>
113117
<a :href="withBase('/page/end-of-life')">Learn more</a>
114118
</div>
115119
</div>
116120
</div>
117121
<div class="home-status-container" v-if="statusPreview.frontmatter.type === 'info'">
118-
<span class="status-content-text">{{ '✅ ' + statusPreview.frontmatter.content + ' '}}</span>
122+
<span class="status-content-text" v-html="md.render('✅ ' + statusPreview.frontmatter.previewContent + ' ')"></span>
119123
<a :href="withBase('/page/status-page')">Learn more</a>
120124
</div>

0 commit comments

Comments
 (0)