Skip to content

Commit 876d95c

Browse files
committed
Fix attributes not being rewritten well
Signed-off-by: Paul-Elliot <[email protected]>
1 parent 7d22bf4 commit 876d95c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

compiler/src/lib/mappings.ml

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@ open Cmarkit
22

33
let of_cmarkit resolve_images =
44
let block m = function
5-
| Block.Block_quote ((bq, ((attrs, _) as a)), meta) ->
5+
| Block.Block_quote ((bq, (attrs, meta2)), meta) ->
66
if Attributes.mem "blockquote" attrs then Mapper.default
77
else
88
let b = Block.Block_quote.block bq in
99
let b =
1010
match Mapper.map_block m b with None -> Block.empty | Some b -> b
1111
in
12-
Mapper.ret (Ast.Div ((b, a), meta))
13-
| Block.Code_block (((cb, _), _) as cbm) ->
12+
let attrs = Mapper.map_attrs m attrs in
13+
Mapper.ret (Ast.Div ((b, (attrs, meta2)), meta))
14+
| Block.Code_block ((cb, (attrs, meta)), meta2) ->
1415
let ret =
1516
match Block.Code_block.info_string cb with
1617
| None -> Mapper.default
1718
| Some (info, _) -> (
1819
match Block.Code_block.language_of_info_string info with
19-
| Some ("slip-script", _) -> Mapper.ret (Ast.SlipScript cbm)
20+
| Some ("slip-script", _) ->
21+
Mapper.ret
22+
(Ast.SlipScript
23+
((cb, (Mapper.map_attrs m attrs, meta)), meta2))
2024
| _ -> Mapper.default)
2125
in
2226
ret

compiler/src/lib/slipshow.ml

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ let embed_in_page content ~starting_state ~has_math ~math_link ~slip_css_link
9393
let convert ?starting_state ?math_link ?slip_css_link ?theorem_css_link
9494
?slipshow_js_link ?(resolve_images = fun x -> Remote x) s =
9595
let md = Cmarkit.Doc.of_string ~heading_auto_ids:true ~strict:false s in
96-
ignore resolve_images;
9796
let md = Cmarkit.Mapper.map_doc (Mappings.of_cmarkit resolve_images) md in
9897
let content =
9998
Cmarkit_renderer.doc_to_string Renderers.custom_html_renderer md

0 commit comments

Comments
 (0)