MARKDOWN(3)

NAME
markdown - process Markdown documents

LIBRARY
Markdown (libmarkdown, -lmarkdown)

SYNOPSIS
#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);

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

To process a file, you pass a FILE* to mkd_in(), and if it returns a nonzero value you pass that in to markdown(), which then writes the converted document to the specified FILE*. 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 mkd_string() and pass its return value to markdown.()

Markdown() accepts the following flag values (or-ed together if needed) to restrict how it processes input:
MKD_NOIMAGE
    Do not process `![]' and remove <img> tags from the output.
MKD_NOLINKS
    Do not process `[]' and remove <a> tags from the output.
MKD_NOPANTS
    Do not do Smartypants-style mangling of quotes, dashes, or ellipses.
MKD_STRICT
    Disable superscript and relaxed emphasis processing (if they are configured; otherwise it's a no-op.)
MKD_NOHEADER
    Do not attempt to parse any Pandoc-style headers.
MKD_TABSTOP
    When reading documents, expand tabs to 4 spaces instead of whatever markdown was originally configured for.
MKD_TOC
    Label all headers for use with the mkd_generatetoc() and mkd_toc() functions.
MKD_1_COMPAT
    MarkdownTest_1.0 compatability flag; trim trailing spaces from the first line of code blocks and disable implicit reference links.
MKD_AUTOLINK
    Greedily urlify links -- if MKD_AUTOLINK is set, urls will be converted into hyperlinks even if they aren't encased in <>.
MKD_SAFELINK
    Don't make hyperlinks from [][] links that have unknown url types.
MKD_NOTABLES
    Don't process tables.

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

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

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

BUGS
Error handling is minimal at best.

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