LOWDOWN_ROFF_RNDR(3)
π LOWDOWN_ROFF_RNDR(3) π
okay so bestie, welcome to the Library Functions Manual entry for lowdown_roff_rndr β and yes she lives in the library βliblowdownβ, come on in π«Ά
β¨ NAME β¨
lowdown_roff_rndr β render Markdown into roff π
π LIBRARY π
library βliblowdownβ πΈ
π SYNOPSIS π
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
int
lowdown_roff_rndr(struct lowdown_buf *out, void *arg,
const struct lowdown_node *n);
π¦ DESCRIPTION π¦
so basically, this function takes a node tree n β the kind you get from lowdown_doc_parse(3) or lowdown_diff(3) β and renders it with the roff renderer arg, which you get back from lowdown_roff_new(3). β¨
the output gets written into out, and heads up: out is your responsibility. you initialise it, you free it. no one else is gonna do that for you, bestie. π
the output is roff output made with the ms, mdoc, or man macro packages. iconic range honestly.
oh and fun history moment π«Ά β this function used to be called lowdown_nroff_rndr(). glow-up era.
π RETURN VALUES π
- returns zero on failure to allocate memory π
- returns non-zero on success π
like yes, she's quirky like that. zero = bad news, non-zero = we ate.
β EXAMPLES β
here's the vibe: this parses b of length bsz and outputs in groff_ms(7) format. periodt.
struct lowdown_buf *out;
struct lowdown_doc *doc;
struct lowdown_node *n;
void *rndr;
if ((doc = lowdown_doc_new(NULL)) == NULL)
err(1, NULL);
if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
err(1, NULL);
if ((out = lowdown_buf_new(256)) == NULL)
err(1, NULL);
if ((rndr = lowdown_roff_new(NULL)) == NULL)
err(1, NULL);
if (!lowdown_roff_rndr(out, rndr, n))
err(1, NULL);
fwrite(out->data, 1, out->size, stdout);
lowdown_roff_free(rndr);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);
look at all that cleanup at the end β main character energy, no leaks on her watch π
π SEE ALSO π
okay so this thing uses both the original troff man macros for Version 7 AT&T UNIX, defined in man(7), and the man-ext groff extensions. both of them are implemented in mandoc. π
the mdoc macros are defined in mdoc(7). π¦
and the troff ms macros are defined in groff_ms(7), along with the mspdf groff extensions described in "Portable Document Format Publishing with GNU Troff" by Keith Marshall. lowkey important: neither of those two are implemented in mandoc. π¨
ngl, if you're counting on ms + mspdf working under mandoc, vibe check says no. π
and that's the whole page, bestie!! π this one comes from the Debian crew, dated $Mdocdate$, and she signs off as LOWDOWN_ROFF_RNDR(3) πΈβ¨ bye pookie, go render some roff π π
π¦ where this page comes from
- alpine 3.24: lowdown-doc 3.0.1-r0 Β· ISC
- arch rolling: lowdown 3.2.1-1 Β· ISC
- nixpkgs unstable: lowdown 3.0.1
- nixpkgs unstable: lowdown-unsandboxed 3.0.1
- 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