package mdx

  1. Overview
  2. Docs

Source file syntax.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open Compat

type t = Normal | Cram | Mli

let pp fs = function
  | Normal -> Fmt.string fs "normal"
  | Cram -> Fmt.string fs "cram"
  | Mli -> Fmt.string fs "mli"

let equal x y = x = y

let infer ~file =
  match Filename.extension file with
  | ".t" -> Some Cram
  | ".md" -> Some Normal
  | ".mli" -> Some Mli
  | _ -> None

let of_string = function
  | "markdown" | "normal" -> Some Normal
  | "cram" -> Some Cram
  | "mli" -> Some Mli
  | _ -> None
OCaml

Innovation. Community. Security.