File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ function createPlugin() {
36
36
{
37
37
colorTheme = 'Default Dark+' ,
38
38
wrapperClassName = '' ,
39
- getWrapperClassName = ( ) => '' ,
40
39
languageAliases = { } ,
41
40
extensions = [ ] ,
42
41
getLineClassName = ( ) => '' ,
@@ -53,7 +52,6 @@ function createPlugin() {
53
52
const lineTransformers = getLineTransformers ( {
54
53
colorTheme,
55
54
wrapperClassName,
56
- getWrapperClassName,
57
55
languageAliases,
58
56
extensions,
59
57
getLineClassName,
@@ -179,17 +177,17 @@ function createPlugin() {
179
177
) ;
180
178
}
181
179
182
- const className = joinClassNames (
183
- wrapperClassName ,
184
- getWrapperClassName ( {
185
- language : languageName ,
186
- markdownNode,
187
- codeFenceNode : node ,
188
- parsedOptions : options ,
189
- } ) ,
190
- themeClassNames ,
191
- 'vscode-highlight'
192
- ) ;
180
+ const wrapperClassNameValue =
181
+ typeof wrapperClassName === 'function'
182
+ ? wrapperClassName ( {
183
+ language : languageName ,
184
+ markdownNode,
185
+ codeFenceNode : node ,
186
+ parsedOptions : options
187
+ } )
188
+ : wrapperClassName ;
189
+
190
+ const className = joinClassNames ( wrapperClassNameValue , themeClassNames , 'vscode-highlight' ) ;
193
191
node . type = 'html' ;
194
192
node . value = renderHTML (
195
193
pre (
Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ type ColorThemeOption = string | ColorThemeSettings | ((data: CodeFenceData) =>
41
41
42
42
interface PluginOptions {
43
43
colorTheme ?: ColorThemeOption ;
44
- wrapperClassName ?: string ;
45
- getWrapperClassName ?: ( data : CodeFenceData ) => string ;
44
+ wrapperClassName ?: string | ( ( data : CodeFenceData ) => string ) ;
46
45
languageAliases ?: Record < string , string > ;
47
46
extensions ?: ExtensionDemand [ ] ;
48
47
getLineClassName ?: ( line : LineData ) => string ;
You can’t perform that action at this time.
0 commit comments