Source file highlighted_text.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
open Core
module Chunk = struct
type t =
{ text : string
; hl_group : string option
}
let to_msgpack { text; hl_group } =
match hl_group with
| None -> Msgpack.Array [ String text ]
| Some hl_group -> Array [ String text; String hl_group ]
;;
end
type t = Chunk.t list
let to_msgpack t = List.map t ~f:Chunk.to_msgpack