let esc x = let fn a c = match c with | '&' -> a ^ "&" | '<' -> a ^ "<" | '"' -> a ^ """ | '\''-> a ^ "'" | x -> a ^ String.make 1 x in Seq.fold_left fn "" (String.to_seq x) type t = string let blank_line a = a ^ "" let plain_text s a = a ^ esc s let sentence_s a = a ^ "" let sentence_e a = a ^ " " let sentence_segment s a = a ^ esc s ^ " " let reference_name n a = a ^ {||} ^ esc n ^ "" let bracketed_referent_s n a = a ^ {||} ^ esc n ^ ": " let bracketed_referent_e a = a ^ "
" let angled_uri u a = a ^ {|<|} ^ esc u ^ {|>|} let bold t a = a ^ "" ^ esc t ^ "" let italic t a = a ^ "" ^ esc t ^ "" let underline t a = a ^ "" ^ esc t ^ "" let inline_monospace t a = a ^ "" ^ esc t ^ "" let heading_hashbang lvl h a = let lvl = string_of_int lvl in a ^ "" ^ esc h ^ "" let paragraph_s a = a ^ "

" let paragraph_e a = a ^ "

" let preformatted s a = a ^ "
" ^ esc s ^ "
" let bullet_list_s a = a ^ "" let bullet_item_s _ch a = a ^ "
  • " let bullet_item_e a = a ^ "
  • " let ordered_list_s a = a ^ "
      " let ordered_list_e a = a ^ "
    " let ordered_item_s = bullet_item_s let ordered_item_e = bullet_item_e let key_value k v a = prerr_endline @@ k ^ "~" ^ v; a