LOWDOWN_DOC_NEW(3)
β¨ LOWDOWN_DOC_NEW(3) β¨
okay so bestie, we're in the Library Functions Manual part of the liblowdown saga, and this page is literally just about one lil function: lowdown_doc_new. she's the girl who sets everything up π
πΈ NAME πΈ
lowdown_doc_new β allocate a Markdown parser
π LIBRARY π
the library is βliblowdownβ π
π¦ SYNOPSIS π¦
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
struct lowdown_doc *
lowdown_doc_new(const struct lowdown_opts *opts);
π DESCRIPTION π
so what she does is she allocates a Markdown parser instance with the configuration you hand her in opts. that's it, that's the job, she's an icon, she ate π
β¨
now β if opts is NULL, every value is assumed to be zero, except the maximum parse depth, which is fixed at 128. no cap. that one's just built different π₯
the instance she gives you back? you can use it with multiple invocations of lowdown_doc_parse(3). she's reusable, she's versatile, she's main character energy π
π RETURN VALUES π
she returns a pointer to the parser, or NULL on memory allocation failure π (rare but real, vibe check failed).
the returned pointer must be freed with a call to lowdown_doc_free(3). do not ghost her. free your girl π«Ά
also important: any pointer values in opts, like the ones chilling in meta and metaovr, get copied over, so they don't need to persist after you pass them to lowdown_doc_new(). you can let them go, they're safe, they're memorised, it's giving "I already screenshotted it" πΈ
π EXAMPLES π
here's a little demo where she parses b if the length is bsz, and then justβ¦ throws the result away. dramatic? yes. useful? also yes π
struct lowdown_doc *doc;
struct lowdown_node *n;
if ((doc = lowdown_doc_new(NULL)) == NULL)
err(1, NULL);
if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
err(1, NULL);
lowdown_node_free(n);
lowdown_doc_free(doc);
notice how she frees both of them at the end? that's called being a responsible queen πβ¨
π SEE ALSO π
Debian π§ $Mdocdate$ π§ LOWDOWN_DOC_NEW(3)
and that's the whole page bestie, go forth and parse, ily, don't forget to free ππ¦πΈ
π¦ where this page comes from
- alpine 3.24: lowdown-doc 3.0.1-r0 Β· ISC
- arch rolling: lowdown 3.2.1-1 Β· ISC
- debian trixie: liblowdown-dev 2.0.2-2 Β· ISC
- fedora 43: lowdown-libs 2.0.2-2.fc43 Β· ISC AND BSD-3-Clause AND MIT
- fedora 43: lowdown-libs 2.0.2-2.fc43 Β· ISC AND BSD-3-Clause AND MIT
- fedora 44: lowdown-libs 2.0.2-3.fc44 Β· ISC AND BSD-3-Clause AND MIT
- fedora 44: lowdown-libs 2.0.2-3.fc44 Β· ISC AND BSD-3-Clause AND MIT
- nixpkgs unstable: lowdown 3.0.1
- nixpkgs unstable: lowdown-unsandboxed 3.0.1
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- opensuse-leap 16.0: lowdown-devel 1.1.0+git20231119.1200b9f-bp160.1.13 Β· ISC
- ubuntu noble: liblowdown-dev 1.1.0-1 Β· ISC
- ubuntu questing: liblowdown-dev 2.0.2-2
- ubuntu resolute: liblowdown-dev 2.0.4-2 Β· ISC
- ubuntu stonking: liblowdown-dev 3.0.1-1 Β· ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms