Skip to content

Commit cf7e131

Browse files
committed
refactor: remove unused template function and simplify style handling
1 parent 4bbb75d commit cf7e131

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/markdown-it/markmap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import matter from 'gray-matter'
22
import { Transformer } from 'markmap-lib'
33
import { markmapWrapper } from './template'
4-
import { parseFrontmatter, template } from './utils'
4+
import { parseFrontmatter } from './utils'
55
import { config, MARKMAP_CLOSE, MARKMAP_OPEN_RE } from '@/shared'
66

77
import type MarkdownIt from 'markdown-it'
@@ -73,7 +73,7 @@ export function markmap(md: MarkdownIt) {
7373
height,
7474
config.toolbar
7575
)
76-
const styleHTML = `<style>${template(style, { id })}</style>`
76+
const styleHTML = `<style>${style}</style>`
7777

7878
return `${wrapHTML}\n${styleHTML}`
7979
}

src/markdown-it/utils.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { z } from 'zod'
2-
import { template as _template } from 'radashi'
32
import { fromError } from 'zod-validation-error'
43
import { logger } from '@/shared'
54

@@ -24,12 +23,3 @@ export const parseFrontmatter = (data: Record<string, any> = {}, identifier: str
2423
}
2524
return parsedData.data as z.infer<typeof frontmatterSchema>
2625
}
27-
28-
/**
29-
* Replace data by name in template strings.
30-
*/
31-
export const template = (
32-
str: string = "",
33-
data: Record<string, any>,
34-
regex: RegExp = /\$\{(.+?)\}/g
35-
) => _template(str, data, regex)

0 commit comments

Comments
 (0)