LOWDOWN_BUF(3)

NAME
lowdown_buf - parse a Markdown buffer into formatted output

LIBRARY
liblowdown

SYNOPSIS
#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>
void
lowdown_buf(const struct lowdown_opts *opts, const char *buf, size_t bufsz, char **ret, size_t *retsz, struct lowdown_meta **meta, size_t *metasz);

DESCRIPTION
The lowdown_buf() function parses a Markdown buffer buf of size bufsz into an output buffer ret of size retsz according to a configuration opts. The output format is specified by opts->type. If metadata parsing is enabled in opts->feat, meta is returned as an array of metadata of size metasz rendered in the given output format.

Internally, lowdown_buf() invokes lowdown_doc_new(3) with the given opts, creates a renderer for the output format, parses the input with lowdown_doc_parse(3), renders the AST in the given output format, and returns the rendered content as a buffer along with any parsed metadata (if applicable).

On success, the caller is responsible for freeing ret and meta.

SEE ALSO
lowdown(3)

CAVEATS
The lowdown_buf function will invoke exit(3) if internal memory allocation fails. There is no way to catch this condition.