diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-29 12:20:19 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-29 12:50:58 -0800 |
commit | 0566fa09cf2369cef3ea6b459f3d4fcf3a27d0fc (patch) | |
tree | adae2b1e8da52a6edfdb459cba975b257eae2f9a /src/cmark.h | |
parent | 96c7df6a8480b78ddc2540dd85877487af358ceb (diff) |
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.
Diffstat (limited to 'src/cmark.h')
-rw-r--r-- | src/cmark.h | 18 |
1 files changed, 15 insertions, 3 deletions
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 * |