package mdx

  1. Overview
  2. Docs
Executable code blocks inside markdown files

Install

Dune Dependency

Authors

Maintainers

Sources

mdx-2.4.0.tbz
sha256=dde0eb73ebf6108fc5c7e30c4e37dd9f839a59fdb68c6ab61459ac28cba9783a
sha512=5e2472657d8e2b38f8f87284ded405e78f07681f61b46285f26c1f4b4c41ebdb22101da0868982ef39ea5083cefd764e08fd0031236fc639423529931d3fecc7

doc/src/mdx/syntax.ml.html

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
24
type t = Markdown | Cram | Mli | Mld

let pp fs = function
  | Markdown -> Fmt.string fs "markdown"
  | Cram -> Fmt.string fs "cram"
  | Mli -> Fmt.string fs "mli"
  | Mld -> Fmt.string fs "mld"

let equal x y = x = y

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

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

Innovation. Community. Security.