fix: add GFM Tables, Strikeout, task list

This commit is contained in:
ShareVB 2024-09-29 22:54:32 +02:00
parent 098237b012
commit d1fc7ec939
5 changed files with 31 additions and 14 deletions

View file

@ -1,12 +1,19 @@
<script setup lang="ts">
import TurndownService from 'turndown';
import { gfm as addGFM } from '@guyplusplus/turndown-plugin-gfm';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const turndownService = new TurndownService();
addGFM(turndownService);
const inputHtml = ref('');
const outputMarkdown = computed(() => {
return turndownService.turndown(inputHtml.value ?? '');
try {
return turndownService.turndown(inputHtml.value ?? '');
}
catch (e: any) {
return e.toString();
}
});
</script>

View file

@ -0,0 +1,3 @@
declare module '@guyplusplus/turndown-plugin-gfm' {
export function gfm(turndown: any);
}