Library
Module
Module type
Parameter
Class
Class type
Functions to help constructing the elements of a doc
.
E.g.,
let open Omd.Ctor in
let para =
p ~attrs:[ ("class", "my-para") ] [ txt "Content of"; em "this"; txt "paragraph" ]
in
[ blockquote [ para; hr; p [ txt "Content of second paragraph" ] ] ]
Produces
<blockquote> <p class="my-para">Content of<em>this</em>paragraph</p> <hr /> <p>Content of second paragraph</p> </blockquote>
The optional attrs
argument always defaults to an empty list, and can generally be omitted.
txt ~attrs s
is Text (attrs, s)
.
em ~attrs s
is Emph (attrs, txt s)
. See txt
.
val strong :
?attrs:(string * string) list ->
string ->
(string * string) list Omd__.Ast_inline.inline
strong ~attrs s
is Strong (attrs, txt s)
. See txt
.
val code :
?attrs:(string * string) list ->
string ->
(string * string) list Omd__.Ast_inline.inline
code ~attrs s
is Code (attrs, s)
.
br
is Hard_break []
.
nl
is Soft_break []
.
val a :
?attrs:(string * string) list ->
?title:string ->
url:string ->
string ->
(string * string) list Omd__.Ast_inline.inline
a ~attrs ~title ~url label
is a link around the text of label
, pointing to the url
, with the optional title title
and additional attrs
. See Link
.
val img :
?attrs:(string * string) list ->
?title:string ->
alt:string ->
string ->
(string * string) list Omd__.Ast_inline.inline
img ~attrs ~title ~alt src
is an image from the given src
that has the alt
text as a fallback, with the optional title title
and additional attrs
. See Image
.
html s
is an inline HTML string. See Html
.
val p :
?attrs:(string * string) list ->
(string * string) list Omd__.Ast_inline.inline list ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
p ~attrs inlines
is a pragraph block holding the given inline
elements. See Paragraph
.
val ol :
?attrs:(string * string) list ->
?start:int ->
?char:[ `Dot | `Paren ] ->
?spacing:Omd__.Ast_block.List_types.list_spacing ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
list
list ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
ol ~attrs ~start ~char ~spacing items
is like ul
, but constructs an ordered list, where start
is the number to start enumerating from, and char
indicates the character following the number in the enumeration.
char
can be either `Dot
indicating '.'
or `Paren
indicating ')'
, and defaults to `Dot
.start
defaults to 1
.val blockquote :
?attrs:(string * string) list ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
list ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
blockquote ~attrs blocks
is a blockquote element containing the given blocks
. See Blockquote
.
hr
is Thematic_break []
.
val h :
?attrs:(string * string) list ->
int ->
(string * string) list Omd__.Ast_inline.inline list ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
h ~attrs level inlines
is a heading of the given level
comprised of the inlines
. See Heading
.
val code_bl :
?attrs:(string * string) list ->
?lang:string ->
string ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
code_bl ~attrs ~lang code
is a code block labeled with language lang
.
lang
defaults to being absent.See Code_block
val html_bl :
?attrs:(string * string) list ->
string ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
html_bl ~attrs html
is a block-level element of raw HTML. See Html_block
.
val dl :
?attrs:(string * string) list ->
(string * string) list ctor_def_elt list ->
(string * string) list
Omd__.Ast_block.Make(Omd__.Ast_block.InlineContent).block
dl ~attrs elements
is a definition list of the given elements
. See Definition_list
.
E.g.,
dl
[ { term = [ txt "def term 1" ]
; defs =
[ [ txt "definition 1.1" ]
; [ txt "definition 1.2" ]
; [ txt "definition 1.3" ]
]
}
; { term = [ txt "def term 2" ]
; defs =
[ [ txt "definition 2.1" ]
; [ txt "definition 2.2" ]
; [ txt "definition 2.3" ]
]
}
]