mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-08 07:11:03 -04:00
lint/typecheck
This commit is contained in:
parent
1e47eb8570
commit
74b2cba084
2 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ const cardStyles = computed(() => ({
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="Prettified version of your markdown">
|
<n-form-item label="Prettified version of your markdown">
|
||||||
<c-card :style="cardStyles">
|
<c-card :style="cardStyles">
|
||||||
<c-markdown :markdown="rawMd"></c-markdown>
|
<c-markdown :markdown="rawMd" />
|
||||||
</c-card>
|
</c-card>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import DomPurify from 'dompurify';
|
import DomPurify from 'dompurify';
|
||||||
import highlight from "highlight.js";
|
import highlight from 'highlight.js';
|
||||||
import 'highlight.js/styles/atom-one-dark.css';
|
import 'highlight.js/styles/atom-one-dark.css';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{ markdown?: string }>(), { markdown: '' });
|
const props = withDefaults(defineProps<{ markdown?: string }>(), { markdown: '' });
|
||||||
|
@ -14,10 +14,10 @@ marked.use({
|
||||||
},
|
},
|
||||||
|
|
||||||
code(code: string, infoString: string = '') {
|
code(code: string, infoString: string = '') {
|
||||||
const validLanguage = highlight.getLanguage(infoString) ? infoString : 'plaintext'
|
const validLanguage = highlight.getLanguage(infoString) ? infoString : 'plaintext';
|
||||||
const highlightedCode = highlight.highlight(validLanguage, code).value;
|
const highlightedCode = highlight.highlight(validLanguage, code).value;
|
||||||
return `<pre><code class="hljs ${validLanguage}">${highlightedCode}</code></pre>`;
|
return `<pre><code class="hljs ${validLanguage}">${highlightedCode}</code></pre>`;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue