aboutsummaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/src/components/Markdown.vue
blob: 125b0ff96a9a2150a63771a23414385ea65088dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!--
  - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
	<!-- eslint-disable-next-line vue/no-v-html -->
	<div class="markdown" v-html="html" />
</template>

<script setup lang="ts">
import { toRef } from 'vue'
import { useMarkdown } from '../composables/useMarkdown'

const props = withDefaults(
	defineProps<{
		markdown: string
		minHeadingLevel?: 1|2|3|4|5|6
	}>(),
	{
		minHeadingLevel: 2,
	},
)

const { html } = useMarkdown(toRef(props, 'markdown'), toRef(props, 'minHeadingLevel'))
</script>

<style scoped lang="scss">
.markdown {
	:deep {
		ul {
			list-style: disc;
			padding-inline-start: 20px;
		}

		h3, h4, h5, h6 {
			font-weight: 600;
			line-height: 1.5;
			margin-top: 24px;
			margin-bottom: 12px;
			color: var(--color-main-text);
		}

		h3 {
			font-size: 20px;
		}

		h4 {
			font-size: 18px;
		}

		h5 {
			font-size: 17px;
		}

		h6 {
			font-size: var(--default-font-size);
		}
	}
}
</style>