Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions examples/vue-chat/components/openui/TextContent.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<script setup lang="ts">
defineProps<{ props: { text?: string } }>();
import DOMPurify from "dompurify";
import { marked } from "marked";
import { computed } from "vue";

const { props } = defineProps<{ props: { text?: string } }>();

const html = computed(() => {
const raw = marked.parse(props.text ?? "", { async: false });
return DOMPurify.sanitize(raw);
});
</script>

<template>
<p class="text-sm leading-relaxed text-zinc-700 dark:text-zinc-300">{{ props.text ?? "" }}</p>
<p class="text-sm leading-relaxed text-zinc-700 dark:text-zinc-300" v-html="html"></p>
</template>
2 changes: 2 additions & 0 deletions examples/vue-chat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"@openuidev/vue-lang": "workspace:*",
"ai": "^6.0.116",
"chart.js": "^4.5.1",
"dompurify": "^3.4.5",
"marked": "^17.0.5",
"zod": "^4.3.6"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading