From 0566fa09cf2369cef3ea6b459f3d4fcf3a27d0fc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 29 Dec 2014 12:20:19 -0800 Subject: Added options parameter to renderers. To keep the API simple and avoid API changes when new options are added, this is just a long integer. Set it by disjoining options that are defined as powers of 2: e.g. `CMARK_HTML_SOURCEPOS | CMARK_HTML_HARDREAKS`. Test options using `&`: `if (options & CMARK_HTML_SOURCEPOS)`. Added `--hardbreaks` and `--sourcepos` command-line options. --- src/cmark.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/cmark.h') diff --git a/src/cmark.h b/src/cmark.h index 8196158..da81de6 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -416,18 +416,30 @@ cmark_node *cmark_parse_file(FILE *f); /** Render a 'node' tree as XML. */ CMARK_EXPORT -char *cmark_render_xml(cmark_node *root); +char *cmark_render_xml(cmark_node *root, long options); /** Render a 'node' tree as an HTML fragment. It is up to the user * to add an appropriate header and footer. */ CMARK_EXPORT -char *cmark_render_html(cmark_node *root); +char *cmark_render_html(cmark_node *root, long options); /** Render a 'node' tree as a groff man page, without the header. */ CMARK_EXPORT -char *cmark_render_man(cmark_node *root); +char *cmark_render_man(cmark_node *root, long options); + +/** Default writer options. + */ +#define CMARK_OPT_DEFAULT 0 + +/** Include a `data-sourcepos` attribute on all block elements. + */ +#define CMARK_OPT_SOURCEPOS 1 + +/** Render `softbreak` elements as hard line breaks. + */ +#define CMARK_OPT_HARDBREAKS 2 /** # AUTHORS * -- cgit v1.2.3