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

NAME

4     lowdown_term_free — free an Markdown terminal 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_term_free(void *arg);
16

DESCRIPTION

18     Frees the terminal renderer created with lowdown_term_new(3).  If arg is
19     NULL, the function does nothing.
20

EXAMPLES

22     The following parses b of length bsz and outputs in ANSI terminal format.
23
24           struct lowdown_buf *out;
25           struct lowdown_doc *doc;
26           struct lowdown_node *n;
27           void *rndr;
28
29           if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL)
30                   err(1, NULL);
31
32           if ((doc = lowdown_doc_new(NULL)) == NULL)
33                   err(1, NULL);
34           if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
35                   err(1, NULL);
36           if ((out = lowdown_buf_new(256)) == NULL)
37                   err(1, NULL);
38           if ((rndr = lowdown_term_new(NULL)) == NULL)
39                   err(1, NULL);
40           if (!lowdown_term_rndr(out, rndr, n))
41                   err(1, NULL);
42
43           fwrite(out->data, 1, out->size, stdout);
44
45           lowdown_term_free(rndr);
46           lowdown_buf_free(out);
47           lowdown_node_free(n);
48           lowdown_doc_free(doc);
49

SEE ALSO

51     lowdown(3), lowdown_term_new(3)
52

STANDARDS

54     ANSI escape codes are described in ISO/IEC 6429, previously ECMA-48.
55
56BSD                            December 17, 2023                           BSD
Impressum