LOWDOWN_FILE(3)

πŸ“¦
version 3.2.1 Β· 2 versions
, in alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– LOWDOWN_FILE(3) β€” the group chat edition πŸ’–

okay bestie, gather round, because this is the lowdown_file page from the Library Functions Manual and it's literally about to become your new hyperfixation. it lives in the library liblowdown and it does one thing and it does it flawlessly: it parses a Markdown file into formatted output. slay. πŸ’…


✨ NAME ✨

lowdown_file β€” parse a Markdown file into formatted output πŸŽ€

πŸ“š LIBRARY πŸ“š

library liblowdown πŸ¦‹

✨ SYNOPSIS ✨

#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>

int
lowdown_file(const struct lowdown_opts *opts, FILE *in, char **ret,
    size_t *retsz, struct lowdown_metaq *metaq);

🌸 DESCRIPTION 🌸

so here's the tea β˜•: this function parses a lowdown(5) file stream coming in through in, and it dumps the goods into an output buffer ret that's retsz big β€” all according to the configuration you handed it in opts. the output format? that's decided by opts->type, no cap. πŸ‘‘

and listen β€” if LOWDOWN_METADATA is set inside opts->feat and metaq is not NULL, then metaq gets filled with metadata rendered in the given output format. iconic behaviour, honestly. ✨

🫢 heads up bestie: on success, you are the one responsible for freeing ret and metaq. that's your child now. take care of it.

πŸ’€ RETURN VALUES πŸ’€

returns zero on failure, non-zero on success. and on failure? the values pointed to by res and rsz are undefined β€” like, do not trust them, do not look at them, they are not your friends. 😭

πŸŽ€ EXAMPLES πŸŽ€

okay so this next bit parses standard input into a standalone HTML5 document. it enables footnotes, autolinks, tables, superscript, strikethrough, fenced codeblocks, commonmark, definition lists, extended image attributes, and metadata processing. the output passes through raw HTML and has smart typography. it's giving main character energy fr fr.

struct lowdown_opts opts;
char *buf;
size_t bufsz;

memset(&opts, 0, sizeof(struct lowdown_opts));
opts.type = LOWDOWN_HTML;
opts.feat = LOWDOWN_FOOTNOTES |
        LOWDOWN_AUTOLINK |
        LOWDOWN_TABLES |
        LOWDOWN_SUPER |
        LOWDOWN_STRIKE |
        LOWDOWN_FENCED |
        LOWDOWN_COMMONMARK |
        LOWDOWN_DEFLIST |
        LOWDOWN_IMG_EXT |
        LOWDOWN_METADATA;
opts.oflags = LOWDOWN_HTML_HEAD_IDS |
        LOWDOWN_HTML_NUM_ENT |
        LOWDOWN_HTML_OWASP |
        LOWDOWN_SMARTY |
        LOWDOWN_STANDALONE;
if (!lowdown_file(&opts, stdin, &buf, &bufsz, NULL))
        errx(1, "lowdown_file");
fwrite(buf, 1, bufsz, stdout);
free(buf);

πŸ‘€ SEE ALSO πŸ‘€

lowdown(3), lowdown_metaq_free(3) β€” go read them, they're the supporting cast and they ate. πŸ“


and that's the whole page, bestie!! this one shipped from Debian with the date stamp $Mdocdate$, and it's the LOWDOWN_FILE(3) page, periodt. πŸ’œ now go free your buffers. mwah. 🧚✨