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

NAME

4     lowdown_doc_new — allocate a Markdown parser
5

LIBRARY

7     library “liblowdown”
8

SYNOPSIS

10     #include <sys/queue.h>
11     #include <stdio.h>
12     #include <lowdown.h>
13
14     struct lowdown_doc *
15     lowdown_doc_new(const struct lowdown_opts *opts);
16

DESCRIPTION

18     Allocates a Markdown parser instance with configuration opts.  If opts is
19     NULL, all values are assumed to be zero except for the maximum parse
20     depth, which is fixed at 128.
21
22     The returned instance may be used with multiple invocations of
23     lowdown_doc_parse(3).
24

RETURN VALUES

26     Returns a pointer to the parser or NULL on memory allocation failure.
27     The returned pointer must be freed with a call to lowdown_doc_free(3).
28
29     Any pointer values in opts, such as those in meta and metaovr, are copied
30     over, so they need not persist after being passed to lowdown_doc_new().
31

EXAMPLES

33     The following parses b if length bsz and throws away the result.
34
35           struct lowdown_doc *doc;
36           struct lowdown_node *n;
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
43           lowdown_node_free(n);
44           lowdown_doc_free(doc);
45

SEE ALSO

47     lowdown(3), lowdown_doc_free(3), lowdown_doc_parse(3)
48
49BSD                            December 17, 2023                           BSD
Impressum