LOWDOWN_TREE_RNDR(3)
π lowdown_tree_rndr β the manual page bestie π
okay so real talk, this is LOWDOWN_TREE_RNDR from section 3 of the manual (Library Functions Manual), and it lives in the liblowdown library. she's a little niche but she is iconic for debugging. let's get into it β¨
πΈ NAME πΈ
lowdown_tree_rndr β render Markdown into debugging output πβ¨
π LIBRARY π
library βliblowdownβ π«Ά
β¨ SYNOPSIS β¨
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
int
lowdown_tree_rndr(struct lowdown_buf *out, const struct lowdown_node *n,
const struct lowdown_opts *opts);
like look at that signature. gorgeous. no notes π
π¦ DESCRIPTION π¦
okay so what she does is render a node tree n β and bestie, that tree has to have been made by lowdown_doc_parse(3) or lowdown_diff(3), no bootleg trees allowed π
ββοΈ β and the whole thing gets written into out. heads up: out must be initialised and freed by the caller. that's on you, not her. main character energy means knowing your own responsibilities π
the output? it's a whole UTF-8 tree π³ ngl the format is not standardised and is subject to change, so don't go building your entire personality around parsing it, k? it's giving "just for the vibes, just for debugging."
and here's the tea: unlike every other renderer in the family, lowdown_tree_rndr() accepts no options β so she has no context. literally zero. she's just here to show you the tree. periodt. π
π RETURN VALUES π
- returns zero when it fails to allocate memory π (yes, zero = bad, it's giving chaotic but that's the rule)
- returns non-zero on success β¨ slay
π EXAMPLES π
okay bestie here's the whole routine: this parses b of length bsz and outputs the parse tree. copy it exactly, no improvising π«Ά
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 (!lowdown_tree_rndr(out, n))
err(1, NULL);
fwrite(out->data, 1, out->size, stdout);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);
see how every single allocation gets checked and every single thing gets freed? that's the vibe check passing with flying colors π― don't skip the frees, i'm begging π
π₯ SEE ALSO π₯
iykyk, go read the main page for the whole lore πΈ
k bye, this page is from Debian, version $Mdocdate$, and yes the title really is LOWDOWN_TREE_RNDR(3) β go forth and debug ur trees bestie ππ³β¨
π¦ 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
- 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