LOWDOWN_ODT_NEW(3)
π LOWDOWN_ODT_NEW π
okay bestie, so this is LOWDOWN_ODT_NEW(3), part of the Library Functions Manual β yes, we're deep in the liblowdown cinematic universe and it's giving very much main character. π
β¨ NAME β¨
lowdown_odt_new β allocate a Markdown OpenDocument renderer π
π LIBRARY π
library βliblowdownβ
π¦ SYNOPSIS π¦
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
void *
lowdown_odt_new(const struct lowdown_opts *opts);
π DESCRIPTION π
So what this does is allocate an OpenDocument renderer using opts->flags, or zero if opts is NULL. That field? It's documented over in lowdown(3), iykyk. The pointer you get back can be used with multiple invocations of lowdown_odt_rndr(3) β she's reusable, periodt β and she must be freed with lowdown_odt_free(3). Don't ghost her, free her. π«Ά
Now, the bits that get recognised in opts->oflags? Only two, and they're:
LOWDOWN_SKIP_HTMLLOWDOWN_STANDALONE
And then there's the opts->odt.sty field β if it's not NULL, it overrides the default <office:font-face-decls>, <office:scripts>, and <office:styles> elements of the document styles. Custom styles? Oh she's fancy. π
π RETURN VALUES π
Returns a pointer to the renderer, or NULL on memory failure. π And again, for the people in the back: the returned pointer must be freed with lowdown_odt_free(3).
β οΈ girl. free the pointer. it's literally right there in the docs, twice. no cap.
π EXAMPLES π
okay so this little cutie parses b of length bsz and outputs in βflatβ OpenDocument format. Look at her go:
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);
notice how every single thing gets freed at the end? that's the vibe check passing. πΈ
π SEE ALSO π
lowdown(3), lowdown_odt_free(3), lowdown_odt_rndr(3)
β STANDARDS β
The referenced OpenDocument standard is 1.3: https://docs.oasis-open.org/office/OpenDocument/v1.3/.
and that's the whole page, bestie!! π this little legend ships with Debian, dated $Mdocdate$, and she answers to the name LOWDOWN_ODT_NEW(3). slay, go render something gorgeous. πβ¨π
π¦ 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