1LOWDOWN_LATEX_FREE(3) BSD Library Functions Manual LOWDOWN_LATEX_FREE(3)
2
4 lowdown_latex_free — free a Markdown LaTeX renderer
5
7 library “liblowdown”
8
10 #include <sys/queue.h>
11 #include <stdio.h>
12 #include <lowdown.h>
13
14 void
15 lowdown_latex_free(void *arg);
16
18 Frees the LaTeX renderer created with lowdown_latex_new(3). If arg is
19 NULL, the function does nothing.
20
22 The following parses b of length bsz and outputs in LaTeX format.
23
24 struct lowdown_buf *out;
25 struct lowdown_doc *doc;
26 struct lowdown_node *n;
27 void *rndr;
28
29 if ((doc = lowdown_doc_new(NULL)) == NULL)
30 err(1, NULL);
31 if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
32 err(1, NULL);
33 if ((out = lowdown_buf_new(256)) == NULL)
34 err(1, NULL);
35 if ((rndr = lowdown_latex_new(NULL)) == NULL)
36 err(1, NULL);
37 if (!lowdown_latex_rndr(out, rndr, n))
38 err(1, NULL);
39
40 fwrite(out->data, 1, out->size, stdout);
41
42 lowdown_latex_free(rndr);
43 lowdown_buf_free(out);
44 lowdown_node_free(n);
45 lowdown_doc_free(doc);
46
48 lowdown(3), lowdown_latex_new(3)
49
50BSD December 17, 2023 BSD