Skip to content

Commit

Permalink
Merge branch 'dev/1.10.2' into enterprise
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon committed Nov 11, 2024
2 parents 29985db + fd3dd3e commit cd2e81d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/components/MarkdownContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

<script setup lang="ts">
/* eslint-disable @typescript-eslint/ban-ts-comment */
import 'github-markdown-css/github-markdown.css'
import { ref, defineProps, onMounted, onUnmounted, PropType, watch } from 'vue'
import { marked } from 'marked'
import { useStore } from 'vuex'
import xss from 'xss'
interface TocItem {
Expand Down Expand Up @@ -102,8 +102,15 @@ const setEle = (val: string | undefined) => {
}
}
onMounted(() => {
const { state } = useStore()
onMounted(async () => {
setEle(props.content)
const theme = state.theme
if (theme === 'dark') {
await import('github-markdown-css/github-markdown-dark.css')
} else {
await import('github-markdown-css/github-markdown-light.css')
}
})
onUnmounted(() => {
Expand All @@ -113,3 +120,13 @@ onUnmounted(() => {
watch(() => props.content, setEle)
</script>

<style lang="scss">
[data-theme='dark'] {
.markdown-content {
.markdown-body {
background-color: var(--color-bg-content);
}
}
}
</style>
1 change: 1 addition & 0 deletions src/shims-vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ declare module 'js-sql-parser'
declare module 'highlight.js/lib/core'
declare module 'highlight.js/lib/languages/sql'
declare module 'hocon-parser'
declare module 'github-markdown-css/*.css'
declare module 'to-json-schema'

0 comments on commit cd2e81d

Please sign in to comment.