diff options
-rw-r--r-- | api_test/cplusplus.cpp | 2 | ||||
-rw-r--r-- | api_test/main.c | 9 | ||||
-rw-r--r-- | man/man3/cmark.3 | 9 | ||||
-rw-r--r-- | src/cmark.c | 6 | ||||
-rw-r--r-- | src/cmark.h | 2 |
5 files changed, 16 insertions, 12 deletions
diff --git a/api_test/cplusplus.cpp b/api_test/cplusplus.cpp index b6228a3..5e8f722 100644 --- a/api_test/cplusplus.cpp +++ b/api_test/cplusplus.cpp @@ -8,7 +8,7 @@ void test_cplusplus(test_batch_runner *runner) { static const char md[] = "paragraph\n"; - char *html = cmark_markdown_to_html(md, sizeof(md) - 1); + char *html = cmark_markdown_to_html(md, sizeof(md) - 1, CMARK_OPT_DEFAULT); STR_EQ(runner, html, "<p>paragraph</p>\n", "libcmark works with C++"); free(html); } diff --git a/api_test/main.c b/api_test/main.c index d42cbaf..3390ac6 100644 --- a/api_test/main.c +++ b/api_test/main.c @@ -606,7 +606,8 @@ utf8(test_batch_runner *runner) // Test string containing null character static const char string_with_null[] = "((((\0))))"; char *html = cmark_markdown_to_html(string_with_null, - sizeof(string_with_null) - 1); + sizeof(string_with_null) - 1, + CMARK_OPT_DEFAULT); STR_EQ(runner, html, "<p>((((" UTF8_REPL "))))</p>\n", "utf8 with U+0000"); free(html); @@ -656,7 +657,8 @@ test_continuation_byte(test_batch_runner *runner, const char *utf8) } strcat(expected, "))))</p>\n"); - char *html = cmark_markdown_to_html(buf, strlen(buf)); + char *html = cmark_markdown_to_html(buf, strlen(buf), + CMARK_OPT_DEFAULT); STR_EQ(runner, html, expected, "invalid utf8 continuation byte %d/%d", pos, len); free(html); @@ -667,7 +669,8 @@ static void test_md_to_html(test_batch_runner *runner, const char *markdown, const char *expected_html, const char *msg) { - char *html = cmark_markdown_to_html(markdown, strlen(markdown)); + char *html = cmark_markdown_to_html(markdown, strlen(markdown), + CMARK_OPT_DEFAULT); STR_EQ(runner, html, expected_html, msg); free(html); } diff --git a/man/man3/cmark.3 b/man/man3/cmark.3 index 111d3b8..2a55774 100644 --- a/man/man3/cmark.3 +++ b/man/man3/cmark.3 @@ -1,4 +1,4 @@ -.TH cmark 3 "March 09, 2015" "LOCAL" "Library Functions Manual" +.TH cmark 3 "March 15, 2015" "LOCAL" "Library Functions Manual" .SH NAME .PP @@ -10,7 +10,7 @@ DESCRIPTION Simple Interface .PP -\fIchar *\f[] \fBcmark_markdown_to_html\f[](\fIconst char *text\f[], \fIint len\f[]) +\fIchar *\f[] \fBcmark_markdown_to_html\f[](\fIconst char *text\f[], \fIint len\f[], \fIint options\f[]) .PP Convert \f[I]text\f[] (assumed to be a UTF\-8 encoded string with length @@ -391,7 +391,8 @@ Simple interface: .IP .nf \f[C] -cmark_node *document = cmark_parse_document("Hello *world*", 12); +cmark_node *document = cmark_parse_document("Hello *world*", 12, + CMARK_OPT_DEFAULT); \f[] .fi .PP @@ -399,7 +400,7 @@ Streaming interface: .IP .nf \f[C] -cmark_parser *parser = cmark_parser_new(); +cmark_parser *parser = cmark_parser_new(CMARK_OPT_DEFAULT); FILE *fp = fopen("myfile.md", "r"); while ((bytes = fread(buffer, 1, sizeof(buffer), fp)) > 0) { cmark_parser_feed(parser, buffer, bytes); diff --git a/src/cmark.c b/src/cmark.c index d6e9278..79ceabf 100644 --- a/src/cmark.c +++ b/src/cmark.c @@ -9,14 +9,14 @@ const int cmark_version = CMARK_VERSION; const char cmark_version_string[] = CMARK_VERSION_STRING; -char *cmark_markdown_to_html(const char *text, int len) +char *cmark_markdown_to_html(const char *text, int len, int options) { cmark_node *doc; char *result; - doc = cmark_parse_document(text, len, CMARK_OPT_DEFAULT); + doc = cmark_parse_document(text, len, options); - result = cmark_render_html(doc, CMARK_OPT_DEFAULT); + result = cmark_render_html(doc, options); cmark_node_free(doc); return result; diff --git a/src/cmark.h b/src/cmark.h index 3c68ac6..942c06c 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -24,7 +24,7 @@ extern "C" { * UTF-8-encoded string. */ CMARK_EXPORT -char *cmark_markdown_to_html(const char *text, int len); +char *cmark_markdown_to_html(const char *text, int len, int options); /** ## Node Structure */ |