MKD_FUNCTIONS(3)
π MKD_FUNCTIONS(3) β Library Functions Manual β¨
NAME π
mkd_functions β access and process Markdown documents.
LIBRARY π
Markdown (libmarkdown, -lmarkdown).
SYNOPSIS π¦
#include <mkdio.h>
int
mkd_compile(MMIOT *document, int flags);
int
mkd_css(MMIOT *document, char **doc);
int
mkd_generatecss(MMIOT *document, FILE *output);
int
mkd_document(MMIOT *document, char **doc);
int
mkd_generatehtml(MMIOT *document, FILE *output);
int
mkd_xhtmlpage(MMIOT *document, int flags, FILE *output);
int
mkd_toc(MMIOT *document, char **doc);
void
mkd_generatetoc(MMIOT *document, FILE *output);
void
mkd_cleanup(MMIOT*);
char*
mkd_doc_title(MMIOT*);
char*
mkd_doc_author(MMIOT*);
char*
mkd_doc_date(MMIOT*);
DESCRIPTION π
Okay so bestie, the markdown format supported in this implementation includes Pandoc-style header and inline <style> blocks, and the standard markdown(3) functions do not provide access to the data provided by either of those extensions. These functions give you access to that data, plus they provide a finer-grained way of converting Markdown documents into HTML.
Given a MMIOT* generated by mkd_in() or mkd_string(), mkd_compile() compiles the document into <style>, Pandoc, and html sections.
Once compiled, the document can be examined and written by the mkd_css(), mkd_document(), mkd_generatecss(), mkd_generatehtml(), mkd_generatetoc(), mkd_toc(), mkd_xhtmlpage(), mkd_doc_title(), mkd_doc_author(), and mkd_doc_date() functions.
mkd_css() allocates a string and populates it with any <style> sections provided in the document, mkd_generatecss() writes any <style> sections to the output, mkd_document() points text to the text of the document and returns the size of the document, mkd_generatehtml() writes the rest of the document to the output, and mkd_doc_title(), mkd_doc_author(), mkd_doc_date() are used to read the contents of a Pandoc header, if any.
mkd_xhtmlpage() writes a xhtml page containing the document. The regular set of flags can be passed.
mkd_toc() writes a document outline, in the form of a collection of nested lists with links to each header in the document, into a string allocated with malloc(), and returns the size.
mkd_generatetoc() is like mkd_toc(), except that it writes the document outline to the given FILE* argument.
mkd_cleanup() deletes a MMIOT* after processing is done.
mkd_compile() accepts the same flags that markdown() and mkd_string() do:
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_TAGTEXTβ Process the input as if you were inside a html tag. This means that no html tags will be generated, andmkd_compile()will attempt to escape anything that might terribly confuse a web browser.MKD_NO_EXTβ Do not process any markdown pseudo-protocols when handing[][]links.MKD_NOHEADERβ Do not attempt to parse any Pandoc-style headers.MKD_TOCβ Label all headers for use with themkd_generatetoc()function.MKD_1_COMPATβ MarkdownTest_1.0 compatibility flag; trim trailing spaces from the first line of code blocks and disable implicit reference links.MKD_NOSTRIKETHROUGHβ Disable strikethrough support.
RETURN VALUES β
The function mkd_compile() returns 1 in the case of success, or 0 if the document is already compiled. The function mkd_generatecss() returns the number of bytes written in the case of success, or EOF if an error occurred. The function mkd_generatehtml() returns 0 on success, -1 on failure.
SEE ALSO π₯
http://daringfireball.net/projects/markdown/syntax
BUGS π
Error handling is minimal at best.
This was MKD_FUNCTIONS(3) from the Library Functions Manual. Footer says Mastodon, January 18, 2008. K bye bestie, go compile some markdown π
β¨π«Ά
π¦ where this page comes from
- arch rolling: discount 3.0.2.0-1 Β· BSD-3-Clause
- debian bookworm: libmarkdown2-dev 2.2.7-2 Β· BSD-3-clause-like
- debian trixie: libmarkdown2-dev 2.2.7-2.1 Β· BSD-3-clause-like
- epel 10: discount 2.2.7-9.el10_0 Β· BSD
- epel 9: libmarkdown-devel 2.2.4-7.el9 Β· BSD
- fedora 43: discount 2.2.7-12.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: discount 2.2.7-14.fc44 Β· LicenseRef-Callaway-BSD
- opensuse-leap 16.0: libmarkdown-devel 3.0.0a-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libmarkdown-devel 3.0.0a-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libmarkdown-devel 3.0.0a-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libmarkdown-devel 3.0.0a-160000.2.2 Β· BSD-3-Clause
- ubuntu jammy: libmarkdown2-dev 2.2.7-2 Β· BSD-3-clause-like
- ubuntu noble: libmarkdown2-dev 2.2.7-2build1 Β· BSD-3-clause-like
- ubuntu questing: libmarkdown2-dev 2.2.7-2.1
- ubuntu resolute: libmarkdown2-dev 2.2.7-2.1build1 Β· BSD-3-clause-like
- ubuntu stonking: libmarkdown2-dev 2.2.7-2.1build1 Β· BSD-3-clause-like
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms