1MARKDOWN(3) BSD Library Functions Manual MARKDOWN(3)
2
4 markdown — process Markdown documents
5
7 Markdown (libmarkdown, -lmarkdown)
8
10 #include <mkdio.h>
11
12 MMIOT
13 *mkd_in(FILE *input, int flags);
14
15 MMIOT
16 *mkd_string(char *string, int size, int flags);
17
18 int
19 markdown(MMIOT *doc, FILE *output, int flags);
20
22 These functions convert Markdown documents and strings into HTML.
23 markdown() processes an entire document, while mkd_text() processes a
24 single string.
25
26 To process a file, you pass a FILE* to mkd_in(), and if it returns a
27 nonzero value you pass that in to markdown(), which then writes the con‐
28 verted document to the specified FILE*. If your input has already been
29 written into a string (generated input or a file opened with mmap(2)) you
30 can feed that string to mkd_string() and pass its return value to
31 markdown.()
32
33 Markdown() accepts the following flag values (or-ed together if needed)
34 to restrict how it processes input:
35 MKD_NOLINKS Don't do link processing, block <a> tags.
36 MKD_NOIMAGE Don't do image processing, block <img>.
37 MKD_NOPANTS Don't run smartypants().
38 MKD_NOHTML Don't allow raw html through AT ALL
39 MKD_STRICT Disable superscript and relaxed emphasis.
40 MKD_TAGTEXT Process text to put inside an html tag (ID=, NAME=,
41 <title>, &tc); no <em>, no <bold>, no html or []
42 expansion.
43 MKD_NO_EXT Don't allow pseudo-protocols.
44 MKD_CDATA Generate code for xml ![CDATA[...]].
45 MKD_NOSUPERSCRIPT Don't generate superscripts. Emphasis happens
46 _everywhere_
47 MKD_NOTABLES Disallow tables.
48 MKD_NOSTRIKETHROUGH Forbid ~~strikethrough~~.
49 MKD_TOC Do table-of-contents processing.
50 MKD_1_COMPAT Compatibility with MarkdownTest_1.0
51 MKD_AUTOLINK Make http://foo.com into a link even without <> s.
52 MKD_SAFELINK Paranoid check for link protocol.
53 MKD_NOHEADER Don't process header blocks.
54 MKD_TABSTOP Expand tabs to 4 spaces.
55 MKD_NODIVQUOTE Forbid >%class% blocks.
56 MKD_NOALPHALIST Forbid alphabetic lists.
57 MKD_NODLIST Forbid definition lists.
58 MKD_NODLDISCOUNT Disable the discount definition list syntax style.
59 MKD_DLEXTRA Enable the extra definition list syntax style.
60 MKD_EXTRA_FOOTNOTE Enable markdown extra-style footnotes.
61 MKD_NOSTYLE Do not extract (omit) <style/> blocks from the out‐
62 put.
63 MKD_FENCEDCODE Allow fenced code blocks.
64 MKD_IDANCHOR Use id= anchors instead of <a name=/> for table-of-
65 contents links.
66 MKD_GITHUBTAGS Allow underscore and dash in passed through element
67 names.
68 MKD_URLENCODEDANCHOR
69 Use html5 encoding for multibyte and nonalphanumeric
70 characters rather than hex expansion in toc links.
71
73 markdown() returns 0 on success, 1 on failure. The mkd_in() and
74 mkd_string() functions return a MMIOT* on success, null on failure.
75
77 markdown(1), mkd-callbacks(3), mkd-functions(3), mkd-line(3),
78 markdown(7), mkd-extensions(7), mmap(2).
79
80 http://daringfireball.net/projects/markdown/syntax
81
83 Error handling is minimal at best.
84
85 The MMIOT created by mkd_string() is deleted by the markdown function.
86
87Mastodon December 20, 2007 Mastodon