Files
homebox/frontend/components/global/Markdown.vue
Tonya d4e28e6f3b Upgrade frontend deps, including nuxt (#982)
* feat: begin upgrading deps, still very buggy

* feat: progress

* feat: sort all type issues

* fix: sort type issues

* fix: import sonner styles

* fix: nuxt is the enemy

* fix: try sorting issue with workflows

* fix: update vitest config for dynamic import of path and defineConfig

* fix: add missing import

* fix: add time out to try and fix issues

* fix: add ui:ci:preview task for frontend build in CI mode

* fix: i was silly

* feat: add go:ci:with-frontend task for CI mode and remove ui:ci:preview from e2e workflow

* fix: update baseURL in Playwright config for local testing to use port 7745

* fix: update E2E_BASE_URL and remove wait for timeout in login test for smoother execution
2025-09-04 09:00:25 +01:00

42 lines
1.1 KiB
Vue

<script setup lang="ts">
import MarkdownIt from "markdown-it";
import { imgSize } from "@mdit/plugin-img-size";
import DOMPurify from "dompurify";
type Props = {
source?: string | null;
};
const props = withDefaults(defineProps<Props>(), {
source: null,
});
const md = new MarkdownIt({
html: true,
linkify: true,
typographer: true,
}).use(imgSize);
const raw = computed(() => {
const html = md.render(props.source || "").replace(/\n$/, ""); // remove trailing newline
return DOMPurify.sanitize(html);
});
</script>
<template>
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="markdown text-wrap break-words" v-html="raw" />
</template>
<style scoped>
* {
word-wrap: break-word; /*Fix for long words going out of emelent bounds and issue #407 */
overflow-wrap: break-word; /*Fix for long words going out of emelent bounds and issue #407 */
white-space: pre-wrap; /*Fix for long words going out of emelent bounds and issue #407 */
}
.markdown {
max-width: 100%;
overflow: hidden; /*Fix for long words going out of emelent bounds and issue #407 */
}
</style>