MARKDOWN(3)

NAME
markdown - process Markdown documents

LIBRARY
Markdown (libmarkdown, -lmarkdown)

SYNOPSIS
#include <mkdio.h>
MMIOT
*mkd_in(FILE *input);
MMIOT
*mkd_string(char *string, int size);
int
markdown(MMIOT *doc, FILE *output, int flags);
int
mkd_text(char *string, int size, 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.

The markdown() function expects to recieve a preprocessed text from the mkd_in() or mkd_string() functions, while mkd_text() treats your input text as a single paragraph of markup.

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() and mkd_text() accept the following flag values (or-ed together if needed) to restrict how they process their 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_QUOT
    Expand " to &quot;.
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.

RETURN VALUES
The functions markdown() and mkd_text() return 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-functions(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_text() and mkd_string() is deleted by the markdown function.