mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-07 23:05:11 -04:00
lint
This commit is contained in:
parent
6b1a8d76e5
commit
7c689148d5
2 changed files with 6 additions and 5 deletions
|
@ -2,9 +2,9 @@ import { marked } from 'marked';
|
|||
import highlight from 'highlight.js';
|
||||
import 'highlight.js/styles/atom-one-dark.css';
|
||||
|
||||
export { renderMarkdown }
|
||||
export { renderMarkdown };
|
||||
|
||||
const renderMarkdown = (md: string): string => {
|
||||
function renderMarkdown(md: string): string {
|
||||
const renderer = new marked.Renderer();
|
||||
|
||||
// Override the code rendering function to use highlight.js for syntax highlighting
|
||||
|
@ -18,8 +18,9 @@ const renderMarkdown = (md: string): string => {
|
|||
|
||||
try {
|
||||
return marked(md);
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Markdown parsing error:', error);
|
||||
return `<p>Error rendering Markdown</p>`;
|
||||
return '<p>Error rendering Markdown</p>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { useElementSize, useStorage } from '@vueuse/core';
|
||||
import { renderMarkdown } from './markdown-viewer.service';
|
||||
|
||||
const inputElement = ref<HTMLElement>();
|
||||
const rawMd = useStorage('markdown-viewer:raw-md', '# Hello World');
|
||||
const { height } = useElementSize(inputElement);
|
||||
|
@ -10,7 +11,6 @@ const cardStyles = computed(() => ({
|
|||
overflow: 'scroll',
|
||||
maxHeight: `${height.value}px`,
|
||||
}));
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue