1LOWDOWN_LATEX_RNDR(3)    BSD Library Functions Manual    LOWDOWN_LATEX_RNDR(3)
2

NAME

4     lowdown_latex_rndr — render Markdown into LaTeX
5

LIBRARY

7     library “liblowdown”
8

SYNOPSIS

10     #include <sys/queue.h>
11     #include <stdio.h>
12     #include <lowdown.h>
13
14     int
15     lowdown_latex_rndr(struct lowdown_buf *out, void *arg,
16         const struct lowdown_node *n);
17

DESCRIPTION

19     Renders a node tree n created by lowdown_doc_parse(3) or lowdown_diff(3)
20     using the LaTeX renderer arg as returned by lowdown_latex_new(3).  The
21     output is written into out, which must be initialised and freed by the
22     caller.
23

RETURN VALUES

25     Returns zero on failure to allocate memory, non-zero on success.
26

EXAMPLES

28     The following parses b of length bsz and outputs in LaTeX format.
29
30           struct lowdown_buf *out;
31           struct lowdown_doc *doc;
32           struct lowdown_node *n;
33           void *rndr;
34
35           if ((doc = lowdown_doc_new(NULL)) == NULL)
36                   err(1, NULL);
37           if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
38                   err(1, NULL);
39           if ((out = lowdown_buf_new(256)) == NULL)
40                   err(1, NULL);
41           if ((rndr = lowdown_latex_new(NULL)) == NULL)
42                   err(1, NULL);
43           if (!lowdown_latex_rndr(out, rndr, n))
44                   err(1, NULL);
45
46           fwrite(out->data, 1, out->size, stdout);
47
48           lowdown_latex_free(rndr);
49           lowdown_buf_free(out);
50           lowdown_node_free(n);
51           lowdown_doc_free(doc);
52

SEE ALSO

54     lowdown(3), lowdown_latex_free(3), lowdown_latex_new(3)
55
56BSD                            December 17, 2023                           BSD
Impressum