mirror of
https://github.com/doocs/md.git
synced 2025-02-10 08:45:53 +08:00
feat: GFM alerts support custom css
This commit is contained in:
parent
53a8cd5cd4
commit
2c26d59d7c
@ -51,11 +51,6 @@ export default function markedAlert(options: AlertOptions = {}): MarkedExtension
|
||||
},
|
||||
})
|
||||
|
||||
console.log({
|
||||
...options.theme?.block[className],
|
||||
...options.theme?.block[`${className}-${variantType}`],
|
||||
}, `style`)
|
||||
|
||||
const firstLine = token.tokens?.[0] as Tokens.Paragraph
|
||||
const firstLineText = firstLine.raw?.replace(typeRegexp, ``).trim()
|
||||
|
||||
|
@ -34,7 +34,7 @@ export function customizeTheme(theme: Theme, options: {
|
||||
export function customCssWithTemplate(jsonString: Partial<Record<Block | Inline, PropertiesHyphen>>, color: string, theme: Theme) {
|
||||
const newTheme = customizeTheme(theme, { color })
|
||||
|
||||
const mergeProperties = <T extends Block | Inline = Block>(target: Record<T, PropertiesHyphen>, source: Partial<Record<Block | Inline, PropertiesHyphen>>, keys: T[]) => {
|
||||
const mergeProperties = <T extends Block | Inline | string = Block>(target: Record<T, PropertiesHyphen>, source: Partial<Record<Block | Inline | string, PropertiesHyphen>>, keys: T[]) => {
|
||||
keys.forEach((key) => {
|
||||
if (source[key]) {
|
||||
target[key] = Object.assign(target[key] || {}, source[key])
|
||||
@ -42,7 +42,7 @@ export function customCssWithTemplate(jsonString: Partial<Record<Block | Inline,
|
||||
})
|
||||
}
|
||||
|
||||
const blockKeys: Block[] = [
|
||||
const blockKeys: (Block | string)[] = [
|
||||
`h1`,
|
||||
`h2`,
|
||||
`h3`,
|
||||
@ -55,6 +55,14 @@ export function customCssWithTemplate(jsonString: Partial<Record<Block | Inline,
|
||||
`hr`,
|
||||
`blockquote`,
|
||||
`blockquote_p`,
|
||||
`markdown-alert`,
|
||||
`markdown-alert-title`,
|
||||
`markdown-alert-content-wrapper`,
|
||||
`markdown-alert-title-note`,
|
||||
`markdown-alert-title-tip`,
|
||||
`markdown-alert-title-important`,
|
||||
`markdown-alert-title-warning`,
|
||||
`markdown-alert-title-caution`,
|
||||
`image`,
|
||||
`ul`,
|
||||
`ol`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user