forked from Orc/discount
-
Notifications
You must be signed in to change notification settings - Fork 0
/
markdown.3
137 lines (137 loc) · 2.74 KB
/
markdown.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
.\"
.Dd December 20, 2007
.Dt MARKDOWN 3
.Os Mastodon
.Sh NAME
.Nm markdown
.Nd process Markdown documents
.Sh LIBRARY
Markdown
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft MMIOT
.Fn *mkd_in "FILE *input" "int flags"
.Ft MMIOT
.Fn *mkd_string "char *string" "int size" "int flags"
.Ft int
.Fn markdown "MMIOT *doc" "FILE *output" "int flags"
.Sh DESCRIPTION
These functions
convert
.Em Markdown
documents and strings into HTML.
.Fn markdown
processes an entire document, while
.Fn mkd_text
processes a single string.
.Pp
To process a file, you pass a FILE* to
.Fn mkd_in ,
and if it returns a nonzero value you pass that in to
.Fn markdown ,
which then writes the converted document to the specified
.Em FILE* .
If your input has already been written into a string (generated
input or a file opened
with
.Xr mmap 2 )
you can feed that string to
.Fn mkd_string
and pass its return value to
.Fn markdown.
.Pp
.Fn Markdown
accepts the following flag values (or-ed together if needed)
to restrict how it processes input:
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
.It Ar MKD_NOLINKS
Don't do link processing, block
.Em <a>
tags.
.It Ar MKD_NOIMAGE
Don't do image processing, block
.Em <img> .
.It Ar MKD_NOPANTS
Don't run
.Em smartypants() .
.It Ar MKD_NOHTML
Don't allow raw html through AT ALL
.It Ar MKD_STRICT
Disable
superscript and relaxed emphasis.
.It Ar MKD_TAGTEXT
Process text inside an html tag; no
.Em <em> ,
no
.Em <bold> ,
no html or
.Em []
expansion.
.It Ar MKD_NO_EXT
Don't allow pseudo-protocols.
.It Ar MKD_CDATA
Generate code for xml
.Em ![CDATA[...]] .
.It Ar MKD_NOSUPERSCRIPT
Don't generate superscripts.
Emphasis happens _everywhere_
.It Ar MKD_NOTABLES
Disallow tables.
.It Ar MKD_NOSTRIKETHROUGH
Forbid
.Em ~~strikethrough~~ .
.It Ar MKD_TOC
Do table-of-contents processing.
.It Ar MKD_1_COMPAT
Compatibility with MarkdownTest_1.0
.It Ar MKD_AUTOLINK
Make
.Em http://foo.com
into a link even without
.Em <> s.
.It Ar MKD_SAFELINK
Paranoid check for link protocol.
.It Ar MKD_NOHEADER
Don't process header blocks.
.It Ar MKD_TABSTOP
Expand tabs to 4 spaces.
.It Ar MKD_NODIVQUOTE
Forbid
.Em >%class%
blocks.
.It Ar MKD_NOALPHALIST
Forbid alphabetic lists.
.It Ar MKD_NODLIST
Forbid definition lists.
.It Ar MKD_EXTRA_FOOTNOTE
Enable markdown extra-style footnotes.
.El
.Sh RETURN VALUES
.Fn markdown
returns 0 on success, 1 on failure.
The
.Fn mkd_in
and
.Fn mkd_string
functions return a MMIOT* on success, null on failure.
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr mkd-callbacks 3 ,
.Xr mkd-functions 3 ,
.Xr mkd-line 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 ,
.Xr mmap 2 .
.Pp
http://daringfireball.net/projects/markdown/syntax
.Sh BUGS
Error handling is minimal at best.
.Pp
The
.Ar MMIOT
created by
.Fn mkd_string
is deleted by the
.Nm
function.