1LOWDOWN_HTML_FREE(3) BSD Library Functions Manual LOWDOWN_HTML_FREE(3)
2
4 lowdown_html_free — free a Markdown HTML renderer
5
7 library “liblowdown”
8
10 #include <sys/queue.h>
11 #include <stdio.h>
12 #include <lowdown.h>
13
14 void
15 lowdown_html_free(void *arg);
16
18 Frees the HTML renderer created with lowdown_html_new(3). If arg is
19 NULL, the function does nothing.
20
22 The following parses b of length bsz and outputs in HTML 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_html_new(NULL)) == NULL)
36 err(1, NULL);
37 if (!lowdown_html_rndr(out, rndr, n))
38 err(1, NULL);
39
40 fwrite(out->data, 1, out->size, stdout);
41
42 lowdown_html_free(rndr);
43 lowdown_buf_free(out);
44 lowdown_node_free(n);
45 lowdown_doc_free(doc);
46
48 lowdown(3), lowdown_html_new(3)
49
51 The referenced HTML5 standard is HTML5.2: https://www.w3.org/TR/html52
52 Output is compatible with prior HTML5 standards.
53
54BSD December 17, 2023 BSD