-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/timezone-converter
- Loading branch information
Showing
7 changed files
with
108 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Markdown } from '@vicons/tabler'; | ||
import { defineTool } from '../tool'; | ||
|
||
export const tool = defineTool({ | ||
name: 'Markdown to HTML', | ||
path: '/markdown-to-html', | ||
description: 'Convert Markdown to Html and allow to print (as PDF)', | ||
keywords: ['markdown', 'html', 'converter', 'pdf'], | ||
component: () => import('./markdown-to-html.vue'), | ||
icon: Markdown, | ||
createdAt: new Date('2024-08-25'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script setup lang="ts"> | ||
import markdownit from 'markdown-it'; | ||
import TextareaCopyable from '@/components/TextareaCopyable.vue'; | ||
const inputMarkdown = ref(''); | ||
const outputHtml = computed(() => { | ||
const md = markdownit(); | ||
return md.render(inputMarkdown.value); | ||
}); | ||
function printHtml() { | ||
const w = window.open(); | ||
if (w === null) { | ||
return; | ||
} | ||
w.document.body.innerHTML = outputHtml.value; | ||
w.print(); | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<c-input-text | ||
v-model:value="inputMarkdown" | ||
multiline raw-text | ||
placeholder="Your Markdown content..." | ||
rows="8" | ||
autofocus | ||
label="Your Markdown to convert:" | ||
/> | ||
|
||
<n-divider /> | ||
|
||
<n-form-item label="Output HTML:"> | ||
<TextareaCopyable :value="outputHtml" :word-wrap="true" language="html" /> | ||
</n-form-item> | ||
|
||
<div flex justify-center> | ||
<n-button @click="printHtml"> | ||
Print as PDF | ||
</n-button> | ||
</div> | ||
</div> | ||
</template> |