~toastal/sourcehut-asciidoc-renderer

e801b77ad1c78b9747c152d3a839b9818acea607 — toastal 1 year, 10 months ago fcda2f9
admonitions as aside
1 files changed, 7 insertions(+), 2 deletions(-)

M markup_massager/markup_massager.ml
M markup_massager/markup_massager.ml => markup_massager/markup_massager.ml +7 -2
@@ 24,7 24,9 @@ let markdown_wrapper node =
	let wrapper = Soup.create_element  ~class_:"markdown" "div" in
	Soup.wrap node wrapper

let color_admonitions node =
let aside_n_color_admonitions node =
	(* `aside` is a more semantic element *)
	let () = Soup.set_name "aside" node in
	let add_icon_class c = Soup.select ".Icon" node |> Soup.iter (Soup.add_class c) in
	let cs = Soup.classes node in
	if List.exists (fun x -> x = "tip" || x = "info") cs then


@@ 102,7 104,10 @@ let () =
		|> Soup.iter unwrap_definition_list_items
	in
	(* Admonitions need a lot of love on various platforms *)
	let () = Soup.select ".admonitionblock" soup |> Soup.iter color_admonitions in
	let () =
		Soup.select ".admonitionblock" soup
		|> Soup.iter aside_n_color_admonitions
	in
	(* Run source blocks through `pygmentize` to emulate the Python
	Markdown toolchain *)
	let () =