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 unsigned char *buf, size_t bufsz, unsigned char **ret, size_t *retsz, struct lowdown_meta **meta, size_t *metasz);

DESCRIPTION
The lowdown_buf function is a convenience function to parse a Markdown buffer buf of size bufsz into an output buffer ret of size retsz in one of several formats defined in opts. If metadata parsing is enabled in the options, meta is returned as an array of metadata of size metasz rendered in the given output format. See lowdown(3) for a description of the opts variable and metadata.

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).

The caller is responsible for freeing the output buffer and metadata contents.

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.