MARKDOWN(3) Library Functions Manual MARKDOWN(3)

markdownprocess Markdown documents

Markdown (libmarkdown, -lmarkdown)

#include <mkdio.h>

MMIOT
*mkd_in(FILE *input, int flags);

MMIOT
*mkd_string(char *string, int size, int flags);

int
markdown(MMIOT *doc, FILE *output, int flags);

These functions convert Markdown documents and strings into HTML. () processes an entire document, while () processes a single string.

To process a file, you pass a FILE* to (), and if it returns a nonzero value you pass that in to markdown(), which then writes the converted document to the specified . If your input has already been written into a string (generated input or a file opened with mmap(2)) you can feed that string to () and pass its return value to ()

() accepts the following flag values (or-ed together if needed) to restrict how it processes input:

MKD_NOLINKS
Don't do link processing, block tags.
MKD_NOIMAGE
Don't do image processing, block .
MKD_NOPANTS
Don't run .
MKD_NOHTML
Don't allow raw html through AT ALL
MKD_STRICT
Disable superscript and relaxed emphasis.
MKD_TAGTEXT
Process text to put inside an html tag (ID=, NAME=, <title>, &tc); no , no , no html or expansion.
MKD_NO_EXT
Don't allow pseudo-protocols.
MKD_CDATA
Generate code for xml .
MKD_NOSUPERSCRIPT
Don't generate superscripts. Emphasis happens _everywhere_
MKD_NOTABLES
Disallow tables.
MKD_NOSTRIKETHROUGH
Forbid .
MKD_TOC
Do table-of-contents processing.
MKD_1_COMPAT
Compatibility with MarkdownTest_1.0
MKD_AUTOLINK
Make into a link even without
MKD_SAFELINK
Paranoid check for link protocol.
MKD_NOHEADER
Don't process header blocks.
MKD_TABSTOP
Expand tabs to 4 spaces.
MKD_NODIVQUOTE
Forbid blocks.
MKD_NOALPHALIST
Forbid alphabetic lists.
MKD_NODLIST
Forbid definition lists.
MKD_NODLDISCOUNT
Disable the discount definition list syntax style.
MKD_DLEXTRA
Enable the extra definition list syntax style.
MKD_EXTRA_FOOTNOTE
Enable markdown extra-style footnotes.
MKD_NOSTYLE
Do not extract (omit) <style/> blocks from the output.
MKD_FENCEDCODE
Allow fenced code blocks.
MKD_IDANCHOR
Use id= anchors instead of <a name=/> for table-of-contents links.
MKD_GITHUBTAGS
Allow underscore and dash in passed through element names.
MKD_URLENCODEDANCHOR
Use html5 encoding for multibyte and nonalphanumeric characters rather than hex expansion in toc links.

markdown() returns 0 on success, 1 on failure. The mkd_in() and mkd_string() functions return a MMIOT* on success, null on failure.

markdown(1), mkd-callbacks(3), mkd-functions(3), mkd-line(3), markdown(7), mkd-extensions(7), mmap(2).

http://daringfireball.net/projects/markdown/syntax

Error handling is minimal at best.

The MMIOT created by mkd_string() is deleted by the markdown function.

December 20, 2007 Mastodon