MARKDOWN(3)
π MARKDOWN(3) β markdown, the iconic library functions manual π
okay so bestie, gather round, because today we're talking about markdown β the literal main character of libmarkdown β and she processes Markdown documents. no cap. π
πΈ LIBRARY πΈ
Markdown (libmarkdown, link it with -lmarkdown). she's right there, waiting for you. π«Ά
β¨ 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, fr fr. markdown() handles a whole entire document, while mkd_text() just does a single string. different vibes, same family. π
so to process a file, you hand a FILE* over to mkd_in(), and if it comes back nonzero you pass that into markdown(), which then writes the converted document to the FILE* you specified. slay. and if your input is already sitting in a string β like, generated input, or a file you opened with mmap(2) β you can feed that string straight into mkd_string() and pass its return value to markdown.(). easy. π
Markdown() accepts these flag values (or-ed together if you need to stack them, go off) to restrict how it processes input:
MKD_NOLINKSβ don't do link processing, block<a>tags. not today. π«MKD_NOIMAGEβ don't do image processing, block<img>.MKD_NOPANTSβ don't runsmartypants(). the pants stay off, bestie.MKD_NOHTMLβ don't allow raw html through AT ALL. screaming, crying, no html.MKD_STRICTβ disable superscript and relaxed emphasis. strict era. π€MKD_TAGTEXTβ process text to put inside an html tag (ID=,NAME=,<title>, &tc); 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. queen behavior. πMKD_1_COMPATβ compatibility withMarkdownTest_1.0MKD_AUTOLINKβ makehttp://foo.cominto 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β useid=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.
π¦ RETURN VALUES π¦
markdown() returns 0 on success, 1 on failure. so like, binary. π the mkd_in() and mkd_string() functions return a MMIOT* on success, and null on failure.
β SEE ALSO β
http://daringfireball.net/projects/markdown/syntax
π BUGS π
error handling is minimal at best. like, minimal minimal. she's trying her best okay π
the MMIOT created by mkd_string() is deleted by the markdown function. noted. don't touch it after, bestie. π
and that's the whole page, you ate it, no crumbs πβ¨ this little manual came from Mastodon, dated December 20, 2007 β yeah, she's vintage, she's a classic, and she's still serving. MARKDOWN(3) out. ππ§
π¦ where this page comes from
- arch rolling: discount 3.0.2.0-1 Β· BSD-3-Clause
- 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
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms