LIBRARY
Markdown (libmarkdown , -lmarkdown)SYNOPSIS
Fd #include <mkdio.h> Ft MMIOT Fn *mkd_in FILE *input int flags Ft MMIOT Fn *mkd_string char *string int size int flags Ft int Fn markdown MMIOT *doc FILE *output int flagsDESCRIPTION
These functions convert Markdown documents and strings into HTML. Fn markdown processes an entire document, while Fn mkd_text processes a single string.To process a file, you pass a FILE* to Fn mkd_in , and if it returns a nonzero value you pass that in to Fn 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 Fn mkd_string and pass its return value to Fn markdown.
Fn Markdown accepts the following flag values (or-ed together if needed) to restrict how it processes input:
- MKD_NOLINKS
- Don't do link processing, block <a> tags.
- MKD_NOIMAGE
- Don't do image processing, block <img>
- MKD_NOPANTS
- Don't run smartypants()
- MKD_NOHTML
- Don't allow raw html through AT ALL
- MKD_STRICT
- Disable superscript and relaxed emphasis.
- MKD_TAGTEXT
- Process text inside an html tag; no <em> no <bold> no html or [] expansion.
- MKD_NO_EXT
- Don't allow pseudo-protocols.
- MKD_CDATA
- Generate code for xml ![CDATA[...]]
- MKD_NOSUPERSCRIPT
- Don't generate superscripts. Emphasis happens _everywhere_
- MKD_NOTABLES
- Disallow tables.
- MKD_NOSTRIKETHROUGH
- Forbid ~~strikethrough~~
- MKD_TOC
- Do table-of-contents processing.
- MKD_1_COMPAT
- Compatibility with MarkdownTest_1.0
- MKD_AUTOLINK
- Make http://foo.com into a link even without <> s.
- MKD_SAFELINK
- Paranoid check for link protocol.
- MKD_NOHEADER
- Don't process header blocks.
- MKD_TABSTOP
- Expand tabs to 4 spaces.
- MKD_NODIVQUOTE
- Forbid >%class% 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 url-encoded chars for multibyte and nonalphanumeric chars rather than dots in toc links.
RETURN VALUES
Fn markdown returns 0 on success, 1 on failure. The Fn mkd_in and Fn mkd_string functions return a MMIOT* on success, null on failure.BUGS
Error handling is minimal at best.The MMIOT created by Fn mkd_string is deleted by the function.