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

NAME

4     lowdown_html_new — allocate a Markdown HTML 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_html_new(const struct lowdown_opts *opts);
16

DESCRIPTION

18     Allocates an HTML5 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_html_rndr(3) and must be freed with
21     lowdown_html_free(3).
22
23     The bits recognised in opts->oflags are LOWDOWN_HTML_OWASP,
24     LOWDOWN_HTML_NUM_ENT, LOWDOWN_HTML_HEAD_IDS, LOWDOWN_HTML_HARD_WRAP,
25     LOWDOWN_HTML_SKIP_HTML, LOWDOWN_HTML_ESCAPE, and LOWDOWN_STANDALONE.
26

RETURN VALUES

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

EXAMPLES

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

SEE ALSO

58     lowdown(3), lowdown_html_free(3), lowdown_html_rndr(3)
59

STANDARDS

61     The referenced HTML5 standard is HTML5.2: https://www.w3.org/TR/html52
62     Output is compatible with prior HTML5 standards.
63
64BSD                            December 17, 2023                           BSD
Impressum