mirror of
https://github.com/doocs/md.git
synced 2025-02-11 17:20:11 +08:00
feat: GFM style changed by theme
This commit is contained in:
parent
014e4b4aea
commit
8dcc2c2756
@ -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 DEFAULT_CSS_CONTENT from '@/assets/example/theme-css.txt?raw'
|
||||||
import { altKey, codeBlockThemeOptions, colorOptions, fontFamilyOptions, fontSizeOptions, legendOptions, shiftKey, themeMap, themeOptions } from '@/config'
|
import { altKey, codeBlockThemeOptions, colorOptions, fontFamilyOptions, fontSizeOptions, legendOptions, shiftKey, themeMap, themeOptions } from '@/config'
|
||||||
import { addPrefix, css2json, customCssWithTemplate, customizeTheme, downloadMD, exportHTML, formatDoc } from '@/utils'
|
import { addPrefix, css2json, customCssWithTemplate, customizeTheme, downloadMD, exportHTML, formatDoc } from '@/utils'
|
||||||
import markedAlert from '@/utils/MDAlert'
|
|
||||||
import { initRenderer } from '@/utils/renderer'
|
import { initRenderer } from '@/utils/renderer'
|
||||||
import { useDark, useStorage, useToggle } from '@vueuse/core'
|
import { useDark, useStorage, useToggle } from '@vueuse/core'
|
||||||
|
|
||||||
@ -186,7 +185,6 @@ export const useStore = defineStore(`store`, () => {
|
|||||||
renderer.setOptions({
|
renderer.setOptions({
|
||||||
theme: newTheme,
|
theme: newTheme,
|
||||||
})
|
})
|
||||||
marked.use(markedAlert({ theme: newTheme }))
|
|
||||||
|
|
||||||
editorRefresh()
|
editorRefresh()
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,6 @@ export function initRenderer(opts: IOpts) {
|
|||||||
let listIndex: number = 0
|
let listIndex: number = 0
|
||||||
let isOrdered: boolean = false
|
let isOrdered: boolean = false
|
||||||
|
|
||||||
marked.use(markedAlert({ theme: opts.theme }))
|
|
||||||
|
|
||||||
function styles(tag: string, addition: string = ``): string {
|
function styles(tag: string, addition: string = ``): string {
|
||||||
return getStyles(styleMapping, tag, addition)
|
return getStyles(styleMapping, tag, addition)
|
||||||
}
|
}
|
||||||
@ -129,6 +127,7 @@ export function initRenderer(opts: IOpts) {
|
|||||||
function setOptions(newOpts: Partial<IOpts>): void {
|
function setOptions(newOpts: Partial<IOpts>): void {
|
||||||
opts = { ...opts, ...newOpts }
|
opts = { ...opts, ...newOpts }
|
||||||
styleMapping = buildTheme(opts)
|
styleMapping = buildTheme(opts)
|
||||||
|
marked.use(markedAlert({ theme: opts.theme }))
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildFootnotes = () => {
|
const buildFootnotes = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user