1LOWDOWN_NROFF_FREE(3) BSD Library Functions Manual LOWDOWN_NROFF_FREE(3)
2
4 lowdown_nroff_free — free a Markdown roff renderer
5
7 library “liblowdown”
8
10 #include <sys/queue.h>
11 #include <stdio.h>
12 #include <lowdown.h>
13
14 void
15 lowdown_nroff_free(void *arg);
16
18 Frees the roff renderer created with lowdown_nroff_new(3). If arg is
19 NULL, the function does nothing.
20
22 The following parses b of length bsz and outputs in groff_ms(7) 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_nroff_new(NULL)) == NULL)
36 err(1, NULL);
37 if (!lowdown_nroff_rndr(out, rndr, n))
38 err(1, NULL);
39
40 fwrite(out->data, 1, out->size, stdout);
41
42 lowdown_nroff_free(rndr);
43 lowdown_buf_free(out);
44 lowdown_node_free(n);
45 lowdown_doc_free(doc);
46
48 lowdown(3), lowdown_nroff_new(3)
49
50 This uses both the original troff man macros for Version 7 AT&T UNIX, de‐
51 fined in man(7), and the man-ext groff extensions. Both are implemented
52 in mandoc.
53
54 The troff ms macros are defined in groff_ms(7), with the mspdf groff ex‐
55 tensions described in "Portable Document Format Publishing with GNU
56 Troff" by Keith Marshall. Neither are implemented in mandoc.
57
58BSD December 17, 2023 BSD