LOWDOWN_BUF(3)
π LOWDOWN_BUF(3) π
okay bestie, so this is a page from the Library Functions Manual β it's the liblowdown girlies' territory, and today we're talking about lowdown_buf. buckle up π
β¨ NAME β¨
lowdown_buf β parse a Markdown buffer into formatted output
π LIBRARY π
library βliblowdownβ π«Ά
πΈ SYNOPSIS πΈ
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
int
lowdown_buf(const struct lowdown_opts *opts, const char *buf,
size_t bufsz, char **ret, size_t *retsz,
struct lowdown_metaq *metaq);
π DESCRIPTION π
so basically π« it parses a lowdown(5) buffer buf of size bufsz into an output buffer ret of size retsz, all according to a configuration opts. the output format? that's whatever opts->type says it is, no cap.
if LOWDOWN_METADATA is set in opts->feat and metaq is not NULL, then metaq gets filled with metadata rendered in the given output format. slay β¨
π¨ important bestie: the caller is responsible for freeingretandmetaq. that's on you, not on us. don't forget, fr fr π
π₯ RETURN VALUES π₯
returns zero on failure, non-zero on success. periodt.
π on failure, the values pointed to byresandrszare undefined. (yes, we know the params are calledretandretszβ the page literally saysresandrsz, and we do not gatekeep, we report. π)
π¦ EXAMPLES π¦
the following 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. iconic honestly π
struct lowdown_opts opts;
char *buf = NULL, *obuf;
char rbuf[1024];
size_t sz, bufsz = 0, obufsz;
while (!(feof(stdin) || ferror(stdin))) {
sz = fread(rbuf, 1, sizeof(rbuf), stdin);
if (sz == 0)
err(1, "fread");
buf = realloc(buf, bufsz + sz);
if (buf == NULL)
err(1, NULL);
memcpy(buf + bufsz, rbuf, sz);
bufsz += sz;
}
if (ferror(stdin))
err(1, "fread");
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_buf(&opts, buf, bufsz, &obuf, &obufsz, NULL))
errx(1, "lowdown_buf");
fwrite(buf, 1, bufsz, stdout);
free(buf);
free(obuf);
π SEE ALSO π
and that's the whole vibe, bestie π this Debian page was served up on $Mdocdate$ under the name LOWDOWN_BUF(3) β go forth and parse, you main character π
π¦ where this page comes from
- alpine 3.24: lowdown-doc 3.0.1-r0 Β· ISC
- arch rolling: lowdown 3.2.1-1 Β· ISC
- debian trixie: liblowdown-dev 2.0.2-2 Β· ISC
- fedora 43: lowdown-libs 2.0.2-2.fc43 Β· ISC AND BSD-3-Clause AND MIT
- fedora 43: lowdown-libs 2.0.2-2.fc43 Β· ISC AND BSD-3-Clause AND MIT
- fedora 44: lowdown-libs 2.0.2-3.fc44 Β· ISC AND BSD-3-Clause AND MIT
- fedora 44: lowdown-libs 2.0.2-3.fc44 Β· ISC AND BSD-3-Clause AND MIT
- nixpkgs unstable: lowdown 3.0.1
- nixpkgs unstable: lowdown-unsandboxed 3.0.1
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- ubuntu noble: liblowdown-dev 1.1.0-1 Β· ISC
- ubuntu questing: liblowdown-dev 2.0.2-2
- ubuntu resolute: liblowdown-dev 2.0.4-2 Β· ISC
- ubuntu stonking: liblowdown-dev 3.0.1-1 Β· ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms