Skip to content

Commit cc09dfd

Browse files
committed
typst - forward class and attributes on codeblock in listing
This ensure to have proper syntax highlighting.
1 parent 1edfc6c commit cc09dfd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/resources/filters/customnodes/floatreftarget.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,13 @@ end, function(float)
10171017
-- Listings shouldn't emit centered blocks.
10181018
-- We don't know how to disable that right now using #show rules for #figures in template.
10191019
content:insert(1, pandoc.RawBlock("typst", "#set align(left)"))
1020+
1021+
-- Classes and attributes for the CodeBlocks needs to be set from the parsed floats to the CodeBlock
1022+
local found_listing = get_node_from_float_and_type(float, "CodeBlock")
1023+
if found_listing then
1024+
found_listing.attr = merge_attrs(found_listing.attr, pandoc.Attr("", float.classes or {}, float.attributes or {}))
1025+
end
1026+
10201027
end
10211028

10221029
if float.has_subfloats then

0 commit comments

Comments
 (0)