Sitemap
bugscoder

bugscoder

Vuetify Markdown

2 min readJun 21, 2025

Install Markdown

npm install marked

Markdown div

<div class="markdown-content" v-html="renderedMarkdown"></div>

Import markdown

import { marked } from 'marked'

Computed

const response = ref('')

const renderedMarkdown = computed(() => {
if (!response.value) return ''
return marked(response.value)
})

Markdown CSS


.markdown-content {
line-height: 1.6;
color: #333;
}

/* Markdown styling */
.markdown-content :deep(h1),
.markdown-content :deep(h2),
.markdown-content :deep(h3),
.markdown-content :deep(h4),
.markdown-content :deep(h5),
.markdown-content :deep(h6) {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
line-height: 1.25;
}

.markdown-content :deep(h1) {
font-size: 2em;
border-bottom: 1px solid #eaecef;
padding-bottom: 10px;
}

.markdown-content :deep(h2) {
font-size: 1.5em;
border-bottom: 1px solid #eaecef;
padding-bottom: 8px;
}

.markdown-content :deep(h3) {
font-size: 1.25em;
}

.markdown-content :deep(p) {
margin-bottom: 16px;
}

.markdown-content :deep(ul),
.markdown-content :deep(ol) {
margin-bottom: 16px;
padding-left: 24px;
}

.markdown-content :deep(li) {
margin-bottom: 4px;
}

.markdown-content :deep(blockquote) {
margin: 16px 0;
padding: 0 16px;
color: #6a737d;
border-left: 4px solid #dfe2e5;
background-color: #f6f8fa;
}

.markdown-content :deep(code) {
background-color: rgba(27, 31, 35, 0.05);
border-radius: 3px;
font-size: 85%;
margin: 0;
padding: 0.2em 0.4em;
font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
}

.markdown-content :deep(pre) {
background-color: #f6f8fa;
border-radius: 6px;
font-size: 85%;
line-height: 1.45;
overflow: auto;
padding: 16px;
margin-bottom: 16px;
}

.markdown-content :deep(pre code) {
background-color: transparent;
border: 0;
display: inline;
line-height: inherit;
margin: 0;
max-width: auto;
overflow: visible;
padding: 0;
word-wrap: normal;
}

.markdown-content :deep(table) {
border-collapse: collapse;
margin-bottom: 16px;
width: 100%;
}

.markdown-content :deep(table th),
.markdown-content :deep(table td) {
border: 1px solid #dfe2e5;
padding: 6px 13px;
}

.markdown-content :deep(table th) {
background-color: #f6f8fa;
font-weight: 600;
}

.markdown-content :deep(table tr:nth-child(2n)) {
background-color: #f6f8fa;
}

.markdown-content :deep(a) {
color: #0366d6;
text-decoration: none;
}

.markdown-content :deep(a:hover) {
text-decoration: underline;
}

.markdown-content :deep(strong) {
font-weight: 600;
}

.markdown-content :deep(em) {
font-style: italic;
}

/* Syntax highlighting adjustments */
.markdown-content :deep(.hljs) {
background: #f6f8fa !important;
color: #24292e !important;
}

Enable Syntax Highlighting

Get bugscoder’s stories in your inbox

Join Medium for free to get updates from this writer.

Install Highlight.js

npm install highlight.js

Import Highlight.js

import hljs from 'highlight.js'

Import CSS

import 'highlight.js/styles/github.css'
// import 'highlight.js/styles/github.css'
// import 'highlight.js/styles/vs2015.css'
// import 'highlight.js/styles/atom-one-dark.css'

Watch

watch(renderedMarkdown, () => {
nextTick(() => {
hljs.highlightAll()
})
}, { immediate: true })

--

--