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

NAME

4     lowdown_odt_rndr — render Markdown into OpenDocument
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_odt_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 OpenDocument renderer arg as returned by lowdown_odt_new(3).
21     The output is written into out, which must be initialised and freed by
22     the caller.
23
24     The output consists of an OpenDocument document.
25

RETURN VALUES

27     Returns zero on failure to allocate memory, non-zero on success.
28

EXAMPLES

30     The following parses b of length bsz and outputs in “flat” OpenDocument
31     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_odt_new(NULL)) == NULL)
45                   err(1, NULL);
46           if (!lowdown_odt_rndr(out, rndr, n))
47                   err(1, NULL);
48
49           fwrite(out->data, 1, out->size, stdout);
50
51           lowdown_odt_free(rndr);
52           lowdown_buf_free(out);
53           lowdown_node_free(n);
54           lowdown_doc_free(doc);
55

SEE ALSO

57     lowdown(3), lowdown_odt_free(3), lowdown_odt_new(3)
58

STANDARDS

60     The referenced OpenDocument standard is 1.3: https://docs.oasis-
61     open.org/office/OpenDocument/v1.3/
62
63BSD                            December 17, 2023                           BSD
Impressum