Skip to content

Commit

Permalink
Add markdown renderer to default container
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Dec 1, 2024
1 parent af5dff9 commit dbfa1db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
9 changes: 0 additions & 9 deletions client/src/components/Markdown/Markdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { faDownload, faEdit } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import BootstrapVue from "bootstrap-vue";
import MarkdownIt from "markdown-it";
import markdownItRegexp from "markdown-it-regexp";
import { mapActions } from "pinia";
import Vue from "vue";
Expand All @@ -80,13 +78,6 @@ import MarkdownContainer from "./MarkdownContainer.vue";
import LoadingSpan from "components/LoadingSpan.vue";
import StsDownloadButton from "components/StsDownloadButton.vue";
const mdNewline = markdownItRegexp(/<br>/, () => {
return "<div style='clear:both;'/><br>";
});
const md = MarkdownIt();
md.use(mdNewline);
Vue.use(BootstrapVue);
library.add(faDownload, faEdit);
Expand Down
18 changes: 16 additions & 2 deletions client/src/components/Markdown/MarkdownDefault.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
<script setup lang="ts">
defineProps<{
import { computed } from "vue";
import MarkdownIt from "markdown-it";
//@ts-ignore
import markdownItRegexp from "markdown-it-regexp";
const mdNewline = markdownItRegexp(/<br>/, () => {
return "<div style='clear:both;'/><br>";
});
const md = MarkdownIt();
md.use(mdNewline);
const props = defineProps<{
content: string;
}>();
const renderedContent = computed(() => md.render(props.content));
</script>

<template>
<p class="text-justify m-2" v-html="content" />
<p class="text-justify m-2" v-html="renderedContent" />
</template>

0 comments on commit dbfa1db

Please sign in to comment.