Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
feat(post): render post from markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Nov 14, 2022
1 parent 6fc668c commit 1128847
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/post/multiviewer/viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@

<script setup lang="ts">
import { ref, computed } from "vue"
import { Converter } from "showdown"
import type { DeserializedPostResource } from "$/types/documents/post"
import type {
Expand Down Expand Up @@ -211,7 +212,13 @@ interface CustomEvents {
const emit = defineEmits<CustomEvents>()
const post = ref<DeserializedPostResource<"poster"|"posterRole"|"department">>(props.modelValue)
const formattedContent = computed<string>(() => post.value.content.replace(/\r?\n/gu, "<br>"))
const formattedContent = computed<string>(() => {
const converter = new Converter({
"backslashEscapesHTMLTags": true
})
converter.setFlavor("github")
return converter.makeHtml(post.value.content)
})
const hasExistingAttachments = computed<boolean>(() => {
const hasAttachments = !isUndefined(props.modelValue.postAttachments)
Expand Down

0 comments on commit 1128847

Please sign in to comment.