LOWDOWN_HTML_RNDR(3)
β¨ LOWDOWN_HTML_RNDR(3) β¨
okay bestie, pull up a chair, we're doing lowdown_html_rndr from the liblowdown library π this is a Library Functions Manual situation and honestly? iconic.
πΈ NAME πΈ
lowdown_html_rndr β render Markdown into HTML π¦
π LIBRARY π
the library is βliblowdownβ, no cap π«Ά
β¨ SYNOPSIS β¨
like, here's what you gotta include first, literally:
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
and the function signature goes a little something like:
int
lowdown_html_rndr(struct lowdown_buf *out, void *arg,
const struct lowdown_node *n);
π DESCRIPTION π
so basically, this function renders a node tree n β and that tree has to be one that was created by lowdown_doc_parse(3) or lowdown_diff(3) β and it uses the HTML renderer arg as returned by lowdown_html_new(3). π
the output gets written into out, and listen, out must be initialised and freed by you, the caller. not us. that's on you bestie π that's your main character responsibility.
and the output? it's a UTF-8 HTML5 document π periodt.
π₯ RETURN VALUES π₯
- returns zero on failure to allocate memory π
- returns non-zero on success β
that's the whole vibe check, fr fr.
π EXAMPLES π
okay so here's the moment you've been waiting for. the following parses b of length bsz and outputs in HTML format β¨ obsessed:
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_html_new(NULL)) == NULL)
err(1, NULL);
if (!lowdown_html_rndr(out, rndr, n))
err(1, NULL);
fwrite(out->data, 1, out->size, stdout);
lowdown_html_free(rndr);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);
look at all that cleanup at the end π§ she's responsible, she's balanced, she frees everything she allocates. we love a tidy queen π
π SEE ALSO π
go read those too, iykyk π
β STANDARDS β
the referenced HTML5 standard is HTML5.2: https://www.w3.org/TR/html52. and the output is also compatible with prior HTML5 standards πΈ so you're covered either way, no stress.
cute lil sign-off: this page came from the Debian crew, dated $Mdocdate$, and it lives at LOWDOWN_HTML_RNDR(3) π thanks for reading, bestie, now go render some HTML π¦β¨
π¦ 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