feat: GFM style changed by theme

This commit is contained in:
dribble-njr 2024-11-20 21:38:08 +08:00
parent 014e4b4aea
commit 8dcc2c2756
2 changed files with 1 additions and 4 deletions

View File

@ -2,7 +2,6 @@ import DEFAULT_CONTENT from '@/assets/example/markdown.md?raw'
import DEFAULT_CSS_CONTENT from '@/assets/example/theme-css.txt?raw'
import { altKey, codeBlockThemeOptions, colorOptions, fontFamilyOptions, fontSizeOptions, legendOptions, shiftKey, themeMap, themeOptions } from '@/config'
import { addPrefix, css2json, customCssWithTemplate, customizeTheme, downloadMD, exportHTML, formatDoc } from '@/utils'
import markedAlert from '@/utils/MDAlert'
import { initRenderer } from '@/utils/renderer'
import { useDark, useStorage, useToggle } from '@vueuse/core'
@ -186,7 +185,6 @@ export const useStore = defineStore(`store`, () => {
renderer.setOptions({
theme: newTheme,
})
marked.use(markedAlert({ theme: newTheme }))
editorRefresh()
}

View File

@ -104,8 +104,6 @@ export function initRenderer(opts: IOpts) {
let listIndex: number = 0
let isOrdered: boolean = false
marked.use(markedAlert({ theme: opts.theme }))
function styles(tag: string, addition: string = ``): string {
return getStyles(styleMapping, tag, addition)
}
@ -129,6 +127,7 @@ export function initRenderer(opts: IOpts) {
function setOptions(newOpts: Partial<IOpts>): void {
opts = { ...opts, ...newOpts }
styleMapping = buildTheme(opts)
marked.use(markedAlert({ theme: opts.theme }))
}
const buildFootnotes = () => {