Skip to content

Commit 38e5139

Browse files
committed
PB-2088: add markdonw support for previewTitle and previewContent
1 parent d37517a commit 38e5139

8 files changed

Lines changed: 78 additions & 12 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;

.vitepress/theme/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ExampleCodeBlock from '../../components/ExampleCodeBlock.vue'
77
import { createHighlighter } from 'shiki'
88
import type { HighlighterGeneric, BundledLanguage, BundledTheme } from 'shiki'
99
import { createMermaidRenderer } from 'vitepress-mermaid-renderer'
10+
import markdownit from 'markdown-it'
1011

1112
// Create a global instance of the highlighter as Shiki is supposed to be used as a singleton
1213
const highlighterPromise = createHighlighter({

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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ 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+
import markdownit from 'markdown-it'
50+
4951

5052
const lastRelease = releases.at(0)
5153
const statusPreview = status[0]
5254
const announcementsPreview = announcements[0]
55+
const md = markdownit()
5356

5457

5558
let statusContainer = null;
@@ -108,13 +111,13 @@ onUnmounted(() => {
108111
<div class="announcements-container">
109112
<h2 id="home-container-h2">End-of-Life</h2>
110113
<div class="home-container-col">
111-
<h4>{{ announcementsPreview.frontmatter.previewTitle}}</h4>
112-
<span>{{ announcementsPreview.frontmatter.previewContent}}</span>
114+
<h4>{{announcementsPreview.frontmatter.previewTitle}}</h4>
115+
<span v-html="md.render(announcementsPreview.frontmatter.previewContent)"></span>
113116
<a :href="withBase('/page/end-of-life')">Learn more</a>
114117
</div>
115118
</div>
116119
</div>
117120
<div class="home-status-container" v-if="statusPreview.frontmatter.type === 'info'">
118-
<span class="status-content-text">{{ '✅ ' + statusPreview.frontmatter.content + ' '}}</span>
121+
<span class="status-content-text" v-html="md.render('✅ ' + statusPreview.frontmatter.previewContent + ' ')"></span>
119122
<a :href="withBase('/page/status-page')">Learn more</a>
120123
</div>

package-lock.json

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"prettier": "^3.6.2",
1515
"tsx": "^4.19.4",
1616
"vitepress": "1.6.4",
17-
"vitepress-mermaid-renderer": "1.1.5"
17+
"vitepress-mermaid-renderer": "1.1.5",
18+
"markdown-it": "14.1.0"
1819
},
1920
"type": "module",
2021
"engines": {

page/end-of-life.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
previewTitle: 'Planned removal of ch.bfe.komo-projekte'
3-
previewContent: 'The layer _ch.bfe.komo-projekte_ will be removed from chsdi services with the release of December 17th.'
3+
previewContent: 'The layer *ch.bfe.komo-projekte* will be removed from chsdi services with the release of December 17th.'
44
---
55

66
# End-of-Life

page/status-page.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
type: 'info'
3-
title: 'All Systems Operational'
4-
content: 'No ongoing incidents - all services are functioning as expected.'
3+
previewTitle: 'All Systems Operational'
4+
previewContent: 'No ongoing incidents - all services are functioning as expected'
55

66
outline: [2, 3]
77
---
@@ -40,7 +40,7 @@ This page provides the latest status updates for all \*.geo.admin.ch web service
4040
'warning': '⚠️',
4141
'danger': '🚨'
4242
}[$frontmatter.type] || ''
43-
}} **{{ $frontmatter.previewTitle }}**: {{ $frontmatter.content }}
43+
}} **{{ $frontmatter.previewTitle }}**: {{ $frontmatter.previewContent }}
4444

4545
## Incident History
4646

0 commit comments

Comments
 (0)