2023-12-02 18:26:06 -05:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { useStorage } from '@vueuse/core';
|
2023-12-02 20:42:00 -05:00
|
|
|
const rawMd = useStorage('markdown-viewer:raw-md', '# Hello World');
|
2023-12-02 18:26:06 -05:00
|
|
|
const inputElement = ref<HTMLElement>();
|
2023-12-02 20:52:04 -05:00
|
|
|
import { renderMarkdown } from "./markdown-viewer.service";
|
2023-12-02 18:26:06 -05:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<n-form-item
|
|
|
|
label="Your raw MD"
|
|
|
|
>
|
|
|
|
<c-input-text
|
|
|
|
ref="inputElement"
|
|
|
|
v-model:value="rawMd"
|
|
|
|
placeholder="Paste your raw JSON here..."
|
|
|
|
rows="35"
|
|
|
|
multiline
|
|
|
|
autocomplete="off"
|
|
|
|
autocorrect="off"
|
|
|
|
autocapitalize="off"
|
|
|
|
spellcheck="false"
|
|
|
|
monospace
|
|
|
|
/>
|
|
|
|
</n-form-item>
|
|
|
|
<n-form-item label="Prettified version of your MD">
|
2023-12-02 20:42:00 -05:00
|
|
|
<c-card style="width: 100%; overflow: scroll" v-html="renderMarkdown(rawMd)"></c-card>
|
2023-12-02 18:26:06 -05:00
|
|
|
</n-form-item>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.result-card {
|
|
|
|
position: relative;
|
|
|
|
.copy-button {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|