1LOWDOWN_GEMINI_FREE(3) BSD Library Functions Manual LOWDOWN_GEMINI_FREE(3)
2
4 lowdown_gemini_free — free a Markdown gemini renderer
5
7 library “liblowdown”
8
10 #include <sys/queue.h>
11 #include <stdio.h>
12 #include <lowdown.h>
13
14 void
15 lowdown_gemini_free(void *arg);
16
18 Frees the gemini renderer created with lowdown_gemini_new(3). If arg is
19 NULL, the function does nothing.
20
22 The following parses b of length bsz and outputs in Gemini 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 if ((doc = lowdown_doc_new(NULL)) == NULL)
32 err(1, NULL);
33 if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
34 err(1, NULL);
35 if ((out = lowdown_buf_new(256)) == NULL)
36 err(1, NULL);
37 if ((rndr = lowdown_gemini_new(NULL)) == NULL)
38 err(1, NULL);
39 if (!lowdown_gemini_rndr(out, rndr, n))
40 err(1, NULL);
41
42 fwrite(out->data, 1, out->size, stdout);
43
44 lowdown_gemini_free(rndr);
45 lowdown_buf_free(out);
46 lowdown_node_free(n);
47 lowdown_doc_free(doc);
48
50 lowdown(3), lowdown_gemini_new(3)
51
53 The gemini format is documented in Project Gemini:
54 https://gemini.circumlunar.space/docs/specification.html The version at
55 the time of writing is 0.14.3.
56
57BSD December 17, 2023 BSD