MARKDOWN(3)

πŸ“¦
version 3.0.2.0 Β· 2 versions
, in arch rolling, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0

πŸ’– 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 run smartypants(). 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 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 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. πŸ’œπŸ§š