LOWDOWN_ODT_RNDR(3)
β¨ LOWDOWN_ODT_RNDR(3) β¨
okay bestie, so this is a page from the Library Functions Manual and it's literally about lowdown_odt_rndr π
buckle up
πΈ NAME πΈ
lowdown_odt_rndr β render Markdown into OpenDocument
π LIBRARY π
library βliblowdownβ β yes she has a whole library, main character energy fr
π¦ SYNOPSIS π¦
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
int
lowdown_odt_rndr(struct lowdown_buf *out, void *arg,
const struct lowdown_node *n);
π DESCRIPTION π
so what this does is it renders a node tree n β and that tree has to have been created by lowdown_doc_parse(3) or lowdown_diff(3) β using the OpenDocument renderer arg, which you get back from lowdown_odt_new(3). π
the output gets written into out, and heads up: you (the caller) have to initialise it and free it yourself. no one's doing that for you, bestie π
and what comes out the other side? an OpenDocument document. that's the whole vibe. β¨
β RETURN VALUES β
- returns zero on failure to allocate memory (boooo π)
- returns non-zero on success (slay π)
π₯ EXAMPLES π₯
here's the moment you've been waiting for β this parses b of length bsz and outputs in βflatβ OpenDocument format. no cap, it's giving iconic:
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_odt_new(NULL)) == NULL)
err(1, NULL);
if (!lowdown_odt_rndr(out, rndr, n))
err(1, NULL);
fwrite(out->data, 1, out->size, stdout);
lowdown_odt_free(rndr);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);
see how everything gets freed at the end? that's the clean-up routine, we love a tidy queen π§
π SEE ALSO π
go read those too, iykyk π
π STANDARDS π
the referenced OpenDocument standard is 1.3, and here's the link exactly as it lives: https://docs.oasis-open.org/office/OpenDocument/v1.3/ π«Ά
a gentle reminder from your girl: out is your responsibility to initialise and free. don't be the person who forgets. that's not the vibe. π
and that's the whole page!! this one shipped from Debian, version $Mdocdate$, and it goes by LOWDOWN_ODT_RNDR(3) β periodt π
π
π¦ 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