Module Inline.Code_span

Code spans.

type t

The type for code spans.

val make : backtick_count:Layout.count -> Block_line.tight list -> t

make ~backtick_count code_layout is a code span with given parameters.

Warning. Nothing is made to ensure correctness of the data, use of_string to compute the right amount of backticks.

val of_string : ?meta:Meta.t -> string -> t

of_string s is a code span for s. s can start with or include backticks; the appropriate minimal backtick count and possible needed leading and trailing space are computed accordingly. If s contains newlines, blanks after newlines are treated as layout like during parsing. meta is used for the lines of the resulting code layout (see code_layout).

val backtick_count : t -> Layout.count

backtick_count cs is the number of delimiting backticks.

val code : t -> string

code cs computes from code_layout the code in the span cs.

val code_layout : t -> Block_line.tight list

code_layout cs is the code data in a form that allows layout preservation.

The actual code data is the tight block lines concatenated and separated by space and if the result starts and ends with a space and is not only made of spaces, these should be dropped. The code function does all that for you.