mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-28 10:36:14 -04:00
fix: add GFM Tables, Strikeout, task list
This commit is contained in:
parent
098237b012
commit
d1fc7ec939
5 changed files with 31 additions and 14 deletions
|
@ -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>
|
||||
|
||||
|
|
3
src/tools/html-to-markdown/turndown-plugin-gfm.d.ts
vendored
Normal file
3
src/tools/html-to-markdown/turndown-plugin-gfm.d.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
declare module '@guyplusplus/turndown-plugin-gfm' {
|
||||
export function gfm(turndown: any);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue