File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
tools/highlighter-helper/src/node/codeBlockTitle Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
import type { Markdown } from 'vuepress/markdown'
2
+ import { isFunction } from 'vuepress/shared'
2
3
import { resolveAttr } from '../utils/index.js'
3
4
import type {
4
5
CodeBlockTitleRender ,
@@ -16,13 +17,14 @@ const defaultTitleRender: CodeBlockTitleRender = (title, code) =>
16
17
export const codeBlockTitle = (
17
18
md : Markdown ,
18
19
{
19
- codeBlockTitle : titleEnabledOrRender = true ,
20
+ codeBlockTitle : codeBlockTitleOptions = true ,
20
21
} : MarkdownItCodeBlockTitleOptions = { } ,
21
22
) : void => {
22
- if ( titleEnabledOrRender === false ) return
23
+ if ( codeBlockTitleOptions === false ) return
23
24
24
- const titleRender : CodeBlockTitleRender =
25
- titleEnabledOrRender === true ? defaultTitleRender : titleEnabledOrRender
25
+ const titleRender : CodeBlockTitleRender = isFunction ( codeBlockTitleOptions )
26
+ ? codeBlockTitleOptions
27
+ : defaultTitleRender
26
28
27
29
const rawFence = md . renderer . rules . fence !
28
30
You can’t perform that action at this time.
0 commit comments