aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/async/AsyncLdMarkdown.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/components/async/AsyncLdMarkdown.vue')
-rw-r--r--viewer/src/components/async/AsyncLdMarkdown.vue115
1 files changed, 115 insertions, 0 deletions
diff --git a/viewer/src/components/async/AsyncLdMarkdown.vue b/viewer/src/components/async/AsyncLdMarkdown.vue
new file mode 100644
index 0000000..c3f368a
--- /dev/null
+++ b/viewer/src/components/async/AsyncLdMarkdown.vue
@@ -0,0 +1,115 @@
1<!--
2-- ldgallery - A static generator which turns a collection of tagged
3-- pictures into a searchable web gallery.
4--
5-- Copyright (C) 2021 Guillaume FOUET
6--
7-- This program is free software: you can redistribute it and/or modify
8-- it under the terms of the GNU Affero General Public License as
9-- published by the Free Software Foundation, either version 3 of the
10-- License, or (at your option) any later version.
11--
12-- This program is distributed in the hope that it will be useful,
13-- but WITHOUT ANY WARRANTY; without even the implied warranty of
14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-- GNU Affero General Public License for more details.
16--
17-- You should have received a copy of the GNU Affero General Public License
18-- along with this program. If not, see <https://www.gnu.org/licenses/>.
19-->
20
21<!-- eslint-disable vue/no-v-html -->
22<template>
23 <div
24 :class="$style.markdown"
25 v-html="html"
26 />
27</template>
28
29<script setup lang="ts">
30import { marked } from 'marked';
31import { computed } from 'vue';
32
33const props = defineProps({
34 markdown: { type: String, required: true },
35});
36
37const html = computed(() => marked(props.markdown));
38</script>
39
40<style lang="scss" module>
41.markdown {
42 color: white;
43 word-wrap: break-word;
44
45 a {
46 color: #9bcdff;
47 text-decoration: none;
48 }
49
50 hr {
51 background-color: #666;
52 }
53
54 ul,
55 ol {
56 list-style-type: disc;
57 padding-left: 1em;
58 }
59
60 h1 {
61 border-bottom: 1px solid #888;
62 font-size: 2.5em;
63 }
64
65 h2 {
66 border-bottom: 1px solid #666;
67 font-size: 2em;
68 }
69
70 h3 {
71 font-size: 1.5em;
72 }
73
74 h4 {
75 font-size: 1.2em;
76 }
77
78 h5 {
79 font-size: 1em;
80 }
81
82 h6 {
83 color: #777;
84 font-size: 1em;
85 }
86
87 h1,
88 h2,
89 h3,
90 h4,
91 h5,
92 h6 {
93 font-weight: bold;
94 margin: 1em 0 15px 0;
95 }
96
97 h1 + p,
98 h2 + p,
99 h3 + p {
100 margin-top: 10px;
101 }
102
103 pre {
104 color: white;
105 background-color: #2e4049;
106 }
107
108 code {
109 @extend pre;
110 font-family: Consolas, "Liberation Mono", Courier, monospace;
111 font-size: 0.8em;
112 white-space: pre;
113 }
114}
115</style>