cmark

My personal build of CMark ✏️

Commit
384f06dcbc5e904f5b5048f3cca0c030cee6ddc6
Parent
b0a6c472f881a3e0a7b61722fb6fddbcc39e5139
Author
John MacFarlane <jgm@berkeley.edu>
Date

Updated API docs; getters return empty strings if not set.

rather than NULL, as previously documented...

Diffstat

2 files changed, 22 insertions, 16 deletions

Status File Name N° Changes Insertions Deletions
Modified man/man3/cmark.3 19 11 8
Modified src/cmark.h 19 11 8
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
@@ -210,7 +210,8 @@ of the type, or \f[C]"<unknown>"\f[].
 \fIconst char *\f[] \fBcmark_node_get_literal\f[](\fIcmark_node *node\f[])
 
 .PP
-Returns the string contents of \f[I]node\f[], or NULL if none.
+Returns the string contents of \f[I]node\f[], or an empty string if none
+is set.
 
 .PP
 \fIint\f[] \fBcmark_node_set_literal\f[](\fIcmark_node *node\f[], \fIconst char *content\f[])
@@ -291,7 +292,7 @@ Sets the "tightness" of a list. Returns 1 on success, 0 on failure.
 \fIconst char *\f[] \fBcmark_node_get_fence_info\f[](\fIcmark_node *node\f[])
 
 .PP
-Returns the info string from a fenced code block, or NULL if none.
+Returns the info string from a fenced code block.
 
 .PP
 \fIint\f[] \fBcmark_node_set_fence_info\f[](\fIcmark_node *node\f[], \fIconst char *info\f[])
@@ -304,7 +305,8 @@ Sets the info string in a fenced code block, returning 1 on success and
 \fIconst char *\f[] \fBcmark_node_get_url\f[](\fIcmark_node *node\f[])
 
 .PP
-Gets the URL of a link or image \f[I]node\f[], or NULL if none.
+Returns the URL of a link or image \f[I]node\f[], or an empty string if
+no URL is set.
 
 .PP
 \fIint\f[] \fBcmark_node_set_url\f[](\fIcmark_node *node\f[], \fIconst char *url\f[])
@@ -317,7 +319,8 @@ on failure.
 \fIconst char *\f[] \fBcmark_node_get_title\f[](\fIcmark_node *node\f[])
 
 .PP
-Gets the title of a link or image \f[I]node\f[], or NULL if none.
+Returns the title of a link or image \f[I]node\f[], or an empty string
+if no title is set.
 
 .PP
 \fIint\f[] \fBcmark_node_set_title\f[](\fIcmark_node *node\f[], \fIconst char *title\f[])
@@ -330,8 +333,8 @@ on failure.
 \fIconst char *\f[] \fBcmark_node_get_on_enter\f[](\fIcmark_node *node\f[])
 
 .PP
-Gets the literal "on enter" text for a custom \f[I]node\f[], or NULL if
-none.
+Returns the literal "on enter" text for a custom \f[I]node\f[], or an
+empty string if no on_enter is set.
 
 .PP
 \fIint\f[] \fBcmark_node_set_on_enter\f[](\fIcmark_node *node\f[], \fIconst char *on_enter\f[])
@@ -345,8 +348,8 @@ success 0 on failure.
 \fIconst char *\f[] \fBcmark_node_get_on_exit\f[](\fIcmark_node *node\f[])
 
 .PP
-Gets the literal "on exit" text for a custom \f[I]node\f[], or NULL if
-none.
+Returns the literal "on exit" text for a custom \f[I]node\f[], or an
+empty string if no on_exit is set.
 
 .PP
 \fIint\f[] \fBcmark_node_set_on_exit\f[](\fIcmark_node *node\f[], \fIconst char *on_exit\f[])
diff --git a/src/cmark.h b/src/cmark.h
@@ -235,7 +235,8 @@ CMARK_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node);
 CMARK_EXPORT
 const char *cmark_node_get_type_string(cmark_node *node);
 
-/** Returns the string contents of 'node', or NULL if none.
+/** Returns the string contents of 'node', or an empty
+    string if none is set.
  */
 CMARK_EXPORT const char *cmark_node_get_literal(cmark_node *node);
 
@@ -290,7 +291,7 @@ CMARK_EXPORT int cmark_node_get_list_tight(cmark_node *node);
  */
 CMARK_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight);
 
-/** Returns the info string from a fenced code block, or NULL if none.
+/** Returns the info string from a fenced code block.
  */
 CMARK_EXPORT const char *cmark_node_get_fence_info(cmark_node *node);
 
@@ -299,7 +300,8 @@ CMARK_EXPORT const char *cmark_node_get_fence_info(cmark_node *node);
  */
 CMARK_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info);
 
-/** Gets the URL of a link or image 'node', or NULL if none.
+/** Returns the URL of a link or image 'node', or an empty string
+    if no URL is set.
  */
 CMARK_EXPORT const char *cmark_node_get_url(cmark_node *node);
 
@@ -308,7 +310,8 @@ CMARK_EXPORT const char *cmark_node_get_url(cmark_node *node);
  */
 CMARK_EXPORT int cmark_node_set_url(cmark_node *node, const char *url);
 
-/** Gets the title of a link or image 'node', or NULL if none.
+/** Returns the title of a link or image 'node', or an empty
+    string if no title is set.
  */
 CMARK_EXPORT const char *cmark_node_get_title(cmark_node *node);
 
@@ -317,8 +320,8 @@ CMARK_EXPORT const char *cmark_node_get_title(cmark_node *node);
  */
 CMARK_EXPORT int cmark_node_set_title(cmark_node *node, const char *title);
 
-/** Gets the literal "on enter" text for a custom 'node', or
-    NULL if none.
+/** Returns the literal "on enter" text for a custom 'node', or
+    an empty string if no on_enter is set.
  */
 CMARK_EXPORT const char *cmark_node_get_on_enter(cmark_node *node);
 
@@ -329,8 +332,8 @@ CMARK_EXPORT const char *cmark_node_get_on_enter(cmark_node *node);
 CMARK_EXPORT int cmark_node_set_on_enter(cmark_node *node,
                                          const char *on_enter);
 
-/** Gets the literal "on exit" text for a custom 'node', or
-    NULL if none.
+/** Returns the literal "on exit" text for a custom 'node', or
+    an empty string if no on_exit is set.
  */
 CMARK_EXPORT const char *cmark_node_get_on_exit(cmark_node *node);