MARKDOWN(3)
π markdown(3) β the Library Functions Manual glow-up π
okay bestie, so this is markdown(3), a section 3 library function page, and it's literally the whole "process Markdown documents" situation. like. the moment. π
πΈ NAME πΈ
markdown β process Markdown documents π
π LIBRARY π
Markdown, aka libmarkdown, which you link with -lmarkdown. she's a whole library, not just a vibe.
β¨ 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 π¦
so these functions do exactly one iconic thing: they take Markdown documents and strings and turn them into HTML. no cap.
markdown() handles a whole entire document. mkd_text() handles a single string. two different jobs, both eating.
k so here's how you actually use her. wanna process a file? you hand a FILE* to mkd_in(), and if what comes back is nonzero, you pass that into markdown(), which then writes the converted document out to the FILE* you picked. easy.
already got your input sitting in a string? (generated input, or a file you opened with mmap(2), iykyk) then you feed that string to mkd_string() and pass its return value to markdown(). boom. done. π«Ά
π OPTIONS π
Markdown() takes these flag values β or them together with | if you need more than one, she's flexible like that β to restrict how she processes input:
MKD_NOLINKSβ no link processing, and<a>tags get blocked. sorry to the linkers.MKD_NOIMAGEβ no image processing,<img>gets blocked. the girls are not being perceived today.MKD_NOPANTSβ don't runsmartypants(). put the fancy quotes back in the closet.MKD_NOHTMLβ raw html does NOT come through. AT ALL. like, zero. none.MKD_STRICTβ disables superscript and relaxed emphasis. strict mode is giving hall monitor.MKD_TAGTEXTβ process text that's going inside an html tag (thinkID=,NAME=,<title>,&tc). no<em>, no<bold>, no html or[]expansion. she's contained, she's professional.MKD_NO_EXTβ don't allow pseudo-protocols.MKD_CDATAβ generate code for xml![CDATA[...]].MKD_NOSUPERSCRIPTβ no superscripts generated. and emphasis happens everywhere. yes, everywhere everywhere.MKD_NOTABLESβ tables? disallowed. sorry table girlies.MKD_NOSTRIKETHROUGHβ~~strikethrough~~is forbidden. absolutely not. πMKD_TOCβ do table-of-contents processing.MKD_1_COMPATβ compatibility withMarkdownTest_1.0.MKD_AUTOLINKβ makeshttp://foo.cominto a link even with no<>around it. auto-linking, auto-slaying.MKD_SAFELINKβ paranoid check for link protocol. she's just looking out for you bestie.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. so they stay in. noted.MKD_FENCEDCODEβ allow fenced code blocks. ``` gang rise up.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()returns0on success,1on failure. she's a binary queen.mkd_in()andmkd_string()return aMMIOT*on success, and null on failure. π
π SEE ALSO π
markdown(1), mkd-callbacks(3), mkd-functions(3), mkd-line(3), markdown(7), mkd-extensions(7), mmap(2).
and also, for the full lore: http://daringfireball.net/projects/markdown/syntax π
π BUGS π
error handling is minimal at best. like, minimal. don't expect a whole emotional support system from her, okay?
β οΈ also important bestie: theMMIOTcreated bymkd_string()gets deleted by the markdown function. so don't go touching her after. she's gone. π
mastodon wrote this one down, and it's dated December 20, 2007 β so this page is a certified vintage classic, and honestly? she's still serving. periodt. πβ¨
π¦ 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