1MKD_FUNCTIONS(3)         BSD Library Functions Manual         MKD_FUNCTIONS(3)
2

NAME

4     mkd_functions — access and process Markdown documents.
5

LIBRARY

7     Markdown (libmarkdown, -lmarkdown)
8

SYNOPSIS

10     #include <mkdio.h>
11
12     int
13     mkd_compile(MMIOT *document, int flags);
14
15     int
16     mkd_css(MMIOT *document, char **doc);
17
18     int
19     mkd_generatecss(MMIOT *document, FILE *output);
20
21     int
22     mkd_document(MMIOT *document, char **doc);
23
24     int
25     mkd_generatehtml(MMIOT *document, FILE *output);
26
27     int
28     mkd_xhtmlpage(MMIOT *document, int flags, FILE *output);
29
30     int
31     mkd_toc(MMIOT *document, char **doc);
32
33     void
34     mkd_generatetoc(MMIOT *document, FILE *output);
35
36     void
37     mkd_cleanup(MMIOT*);
38
39     char*
40     mkd_doc_title(MMIOT*);
41
42     char*
43     mkd_doc_author(MMIOT*);
44
45     char*
46     mkd_doc_date(MMIOT*);
47

DESCRIPTION

49     The markdown format supported in this implementation includes Pandoc-
50     style header and inline <style> blocks, and the standard markdown(3)
51     functions do not provide access to the data provided by either of those
52     extensions.  These functions give you access to that data, plus they pro‐
53     vide a finer-grained way of converting Markdown documents into HTML.
54
55     Given a MMIOT* generated by mkd_in() or mkd_string(), mkd_compile() com‐
56     piles the document into <style>, Pandoc, and html sections.
57
58     Once compiled, the document can be examined and written by the mkd_css(),
59     mkd_document(), mkd_generatecss(), mkd_generatehtml(), mkd_generatetoc(),
60     mkd_toc(), mkd_xhtmlpage(), mkd_doc_title(), mkd_doc_author(), and
61     mkd_doc_date() functions.
62
63     mkd_css() allocates a string and populates it with any <style> sections
64     provided in the document, mkd_generatecss() writes any <style> sections
65     to the output, mkd_document() points text to the text of the document and
66     returns the size of the document, mkd_generatehtml() writes the rest of
67     the document to the output, and mkd_doc_title(), mkd_doc_author(),
68     mkd_doc_date() are used to read the contents of a Pandoc header, if any.
69
70     mkd_xhtmlpage() writes a xhtml page containing the document.  The regular
71     set of flags can be passed.
72
73     mkd_toc() writes a document outline, in the form of a collection of
74     nested lists with links to each header in the document, into a string
75     allocated with malloc(), and returns the size.
76
77     mkd_generatetoc() is like mkd_toc(), except that it writes the document
78     outline to the given FILE* argument.
79
80     mkd_cleanup() deletes a MMIOT* after processing is done.
81
82     mkd_compile() accepts the same flags that markdown() and mkd_string() do;
83     MKD_NOIMAGE          Do not process `![]' and remove <img> tags from the
84                          output.
85     MKD_NOLINKS          Do not process `[]' and remove <a> tags from the
86                          output.
87     MKD_NOPANTS          Do not do Smartypants-style mangling of quotes,
88                          dashes, or ellipses.
89     MKD_TAGTEXT          Process the input as if you were inside a html tag.
90                          This means that no html tags will be generated, and
91                          mkd_compile() will attempt to escape anything that
92                          might terribly confuse a web browser.
93     MKD_NO_EXT           Do not process any markdown pseudo-protocols when
94                          handing [][] links.
95     MKD_NOHEADER         Do not attempt to parse any Pandoc-style headers.
96     MKD_TOC              Label all headers for use with the mkd_generatetoc()
97                          function.
98     MKD_1_COMPAT         MarkdownTest_1.0 compatibility flag; trim trailing
99                          spaces from the first line of code blocks and dis‐
100                          able implicit reference links.
101     MKD_NOSTRIKETHROUGH  Disable strikethrough support.
102

RETURN VALUES

104     The function mkd_compile() returns 1 in the case of success, or 0 if the
105     document is already compiled.  The function mkd_generatecss() returns the
106     number of bytes written in the case of success, or EOF if an error
107     occurred.  The function mkd_generatehtml() returns 0 on success, -1 on
108     failure.
109

SEE ALSO

111     markdown(1), markdown(3), mkd-line(3), markdown(7), mkd-extensions(7),
112     mmap(2).
113
114     http://daringfireball.net/projects/markdown/syntax
115

BUGS

117     Error handling is minimal at best.
118
119Mastodon                       January 18, 2008                       Mastodon
Impressum