LOWDOWN_GEMINI_RNDR(3)
π LOWDOWN_GEMINI_RNDR(3) π
okay bestie, welcome to lowdown_gemini_rndr from the Library Functions Manual β this is the lil function that turns your Markdown into gemtext and honestly? it ate. π
β¨ NAME β¨
lowdown_gemini_rndr β render Markdown into gemini π¦
π LIBRARY π
library βliblowdownβ β she lives in there, that's her house π
πΈ SYNOPSIS πΈ
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
int
lowdown_gemini_rndr(struct lowdown_buf *out, void *arg,
const struct lowdown_node *n);
π DESCRIPTION π
So here's the tea, bestie π β this function renders a node tree n that was created by lowdown_doc_parse(3) or lowdown_diff(3), using the gemini renderer arg as returned by lowdown_gemini_new(3). The output gets written into out, and you (the caller, the main character) are responsible for initialising it and freeing it. no cap. π«Ά
The caller is also expected to have invoked setlocale(3) to a "UTF-8" character encoding before using this function β otherwise UTF-8 sequences will not be properly recognised. and where does that matter, you ask? it's used when formatting table column widths π. so like, set your locale or your tables are gonna be lowkey busted. π
β RETURN VALUES β
- returns zero on failure to allocate memory π
- returns non-zero on success β¨
that's it. that's the whole vibe check.
π EXAMPLES π
The following parses b of length bsz and outputs in Gemini format. look at her go π§
struct lowdown_buf *out;
struct lowdown_doc *doc;
struct lowdown_node *n;
void *rndr;
if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL)
err(1, NULL);
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_gemini_new(NULL)) == NULL)
err(1, NULL);
if (!lowdown_gemini_rndr(out, rndr, n))
err(1, NULL);
fwrite(out->data, 1, out->size, stdout);
lowdown_gemini_free(rndr);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);
notice how she frees everything at the end? that's called β¨being responsibleβ¨ and we love that for us. π
π₯ SEE ALSO π₯
go read those next, bestie, iykyk π
π STANDARDS π
The gemini βgemtextβ format is documented in Project Gemini: https://geminiprotocol.net. The version at the time of writing is 0.24.1. π¦
and that's the whole page, periodt π thanks for coming to my TED talk, go render some gemtext and slay β¨
β Debian, $Mdocdate$, LOWDOWN_GEMINI_RNDR(3) π bye bestie, ily π«Άπ
π¦ 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