@@ -24,6 +24,7 @@ local utils = require(quarto.utils.resolve_path('_modules/utils.lua'):gsub('%.lu
2424--- @field auto_filename boolean Whether to auto-generate filename from language
2525--- @field style string Window decoration style (' macos' , ' windows' , ' default' )
2626--- @field typst_wrapper string Typst wrapper function name
27+ --- @field skylighting_fix boolean Whether to apply the Skylighting hot-fix for Typst
2728
2829local VALID_STYLES = { [' default' ] = true , [' macos' ] = true , [' windows' ] = true }
2930
@@ -32,6 +33,7 @@ local DEFAULTS = {
3233 [' auto-filename' ] = ' true' ,
3334 [' style' ] = ' macos' ,
3435 [' wrapper' ] = ' code-window' ,
36+ [' skylighting-fix' ] = ' true' ,
3537}
3638
3739local CURRENT_FORMAT = nil
@@ -329,7 +331,7 @@ function Meta(meta)
329331 CURRENT_FORMAT = utils .get_quarto_format ()
330332 local opts = utils .get_options ({
331333 extension = EXTENSION_NAME ,
332- keys = { ' enabled' , ' auto-filename' , ' style' , ' wrapper' },
334+ keys = { ' enabled' , ' auto-filename' , ' style' , ' wrapper' , ' skylighting-fix ' },
333335 meta = meta ,
334336 defaults = DEFAULTS ,
335337 })
@@ -344,6 +346,7 @@ function Meta(meta)
344346 auto_filename = opts [' auto-filename' ] == ' true' ,
345347 style = VALID_STYLES [opts [' style' ]] and opts [' style' ] or ' macos' ,
346348 typst_wrapper = opts [' wrapper' ],
349+ skylighting_fix = opts [' skylighting-fix' ] == ' true' ,
347350 }
348351
349352 if CURRENT_FORMAT == ' html' and CONFIG .enabled then
@@ -435,7 +438,16 @@ local filters = {
435438}
436439
437440for _ , subfilter in ipairs (load_skylighting_hotfix_filters ()) do
438- table.insert (filters , subfilter )
441+ local wrapped = {}
442+ for element_type , handler in pairs (subfilter ) do
443+ wrapped [element_type ] = function (...)
444+ if not CONFIG or not CONFIG .skylighting_fix then
445+ return nil
446+ end
447+ return handler (... )
448+ end
449+ end
450+ table.insert (filters , wrapped )
439451end
440452
441453return filters
0 commit comments