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

NAME

4     lowdown_latex_new — allocate a Markdown LaTeX renderer
5

LIBRARY

7     library “liblowdown”
8

SYNOPSIS

10     #include <sys/queue.h>
11     #include <stdio.h>
12     #include <lowdown.h>
13
14     void *
15     lowdown_latex_new(const struct lowdown_opts *opts);
16

DESCRIPTION

18     Allocates an LaTeX renderer using opts->flags, or zero if opts is NULL.
19     This field is documented in lowdown(3).  The returned pointer may be used
20     with multiple invocations of lowdown_latex_rndr(3) and must be freed with
21     lowdown_latex_free(3).
22
23     The bits recognised in opts->oflags are LOWDOWN_LATEX_NUMBERED,
24     LOWDOWN_LATEX_SKIP_HTML, and LOWDOWN_STANDALONE.
25

RETURN VALUES

27     Returns a pointer to the renderer or NULL on memory failure.  The re‐
28     turned pointer must be freed with lowdown_latex_free(3).
29

EXAMPLES

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

SEE ALSO

57     lowdown(3), lowdown_latex_free(3), lowdown_latex_rndr(3)
58
59BSD                            December 17, 2023                           BSD
Impressum