LOWDOWN_LATEX_RNDR(3)

πŸ“¦
version 3.2.1 Β· 2 versions
, in alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ lowdown_latex_rndr(3) ✨

okay bestie, so this is a page from the Library Functions Manual, and it's literally all about one little function that turns your Markdown into LaTeX πŸ’… no cap.


πŸŽ€ NAME πŸŽ€

lowdown_latex_rndr β€” render Markdown into LaTeX 🌸


πŸ“š LIBRARY πŸ“š

you'll find this in the library β€œliblowdown” 🫢


✨ SYNOPSIS ✨

like, here's how you summon it:

#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>

int
lowdown_latex_rndr(struct lowdown_buf *out, void *arg,
    const struct lowdown_node *n);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea πŸ“: this function renders a node tree n β€” the kind you get from lowdown_doc_parse(3) or lowdown_diff(3) β€” using the LaTeX renderer arg, which is what lowdown_latex_new(3) hands you back.

The output gets written into out, and heads up bestie, out has to be initialised and freed by you, the caller. it's giving main character responsibility, fr fr 😭


πŸ‘‘ RETURN VALUES πŸ‘‘

  • returns zero if it fails to allocate memory πŸ’€
  • returns non-zero on success ✨

so like, yes, zero is the bad one here. don't let it gaslight you.


🌈 EXAMPLES 🌈

the following parses b of length bsz and outputs in LaTeX format. iconic, honestly πŸ¦‹

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_latex_new(NULL)) == NULL)
        err(1, NULL);
if (!lowdown_latex_rndr(out, rndr, n))
        err(1, NULL);

fwrite(out->data, 1, out->size, stdout);

lowdown_latex_free(rndr);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);

see how it frees everything at the end? that's the vibe check passing βœ… don't skip it.


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page bestie πŸ’œ this one shipped from Debian, version $Mdocdate$, filed under LOWDOWN_LATEX_RNDR(3) β€” go forth and render, you absolute icon πŸ‘‘βœ¨