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

NAME

4     lowdown_gemini_new — allocate a Markdown gemini 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_gemini_new(const struct lowdown_opts *opts);
16

DESCRIPTION

18     Allocates a Gemini renderer using opts->oflags, or zero if opts is NULL.
19     The returned pointer may be used with multiple invocations of
20     lowdown_gemini_rndr(3) and must be freed with lowdown_gemini_free(3).
21
22     The bits recognised in opts->oflags are LOWDOWN_GEMINI_LINK_IN,
23     LOWDOWN_GEMINI_LINK_END, LOWDOWN_GEMINI_LINK_NOREF,
24     LOWDOWN_GEMINI_LINK_ROMAN, LOWDOWN_GEMINI_METADATA, and
25     LOWDOWN_STANDALONE.  These are documented in lowdown(3).
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_gemini_free(3).
30

EXAMPLES

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

SEE ALSO

60     lowdown(3), lowdown_gemini_free(3), lowdown_gemini_rndr(3)
61

STANDARDS

63     The gemini format is documented in Project Gemini:
64     https://gemini.circumlunar.space/docs/specification.html The version at
65     the time of writing is 0.14.3.
66
67BSD                            December 17, 2023                           BSD
Impressum