cmark

My personal build of CMark ✏️

Commit
a74295a1ea686611498a75dd45597d224ce99287
Parent
4296462bfe31c877f4826f5734813c88c7240770
Author
John MacFarlane <jgm@berkeley.edu>
Date

Rename 'header' -> 'heading'.

See jgm/CommonMark commit 0cdbcee4e840abd0ac7db93797b2b75ca4104314

Note that we have defined

cmark_node_get_header_level = cmark_node_get_heading_level and cmark_node_set_header_level = camrk_node_set_heading_level

for backwards compatibility in the API.

Diffstat

14 files changed, 107 insertions, 95 deletions

Status File Name N° Changes Insertions Deletions
Modified api_test/main.c 42 21 21
Modified man/man3/cmark.3 14 7 7
Modified src/blocks.c 20 10 10
Modified src/cmark.h 14 9 5
Modified src/commonmark.c 2 1 1
Modified src/html.c 12 6 6
Modified src/latex.c 2 1 1
Modified src/man.c 2 1 1
Modified src/node.c 12 6 6
Modified src/node.h 4 2 2
Modified src/scanners.c 60 34 26
Modified src/scanners.h 8 4 4
Modified src/scanners.re 8 4 4
Modified src/xml.c 2 1 1
diff --git a/api_test/main.c b/api_test/main.c
@@ -72,9 +72,9 @@ constructor(test_batch_runner *runner)
 
 		switch (node->type) {
 		case CMARK_NODE_HEADER:
-			INT_EQ(runner, cmark_node_get_header_level(node), 1,
-			       "default header level is 1");
-			node->as.header.level = 1;
+			INT_EQ(runner, cmark_node_get_heading_level(node), 1,
+			       "default heading level is 1");
+			node->as.heading.level = 1;
 			break;
 
 		case CMARK_NODE_LIST:
@@ -126,11 +126,11 @@ accessors(test_batch_runner *runner)
 
 	// Getters
 
-	cmark_node *header = cmark_node_first_child(doc);
-	INT_EQ(runner, cmark_node_get_header_level(header), 2,
-	       "get_header_level");
+	cmark_node *heading = cmark_node_first_child(doc);
+	INT_EQ(runner, cmark_node_get_heading_level(heading), 2,
+	       "get_heading_level");
 
-	cmark_node *bullet_list = cmark_node_next(header);
+	cmark_node *bullet_list = cmark_node_next(heading);
 	INT_EQ(runner, cmark_node_get_list_type(bullet_list),
 	       CMARK_BULLET_LIST, "get_list_type bullet");
 	INT_EQ(runner, cmark_node_get_list_tight(bullet_list), 1,
@@ -180,8 +180,8 @@ accessors(test_batch_runner *runner)
 
 	// Setters
 
-	OK(runner, cmark_node_set_header_level(header, 3),
-	   "set_header_level");
+	OK(runner, cmark_node_set_heading_level(heading, 3),
+	   "set_heading_level");
 
 	OK(runner, cmark_node_set_list_type(bullet_list, CMARK_ORDERED_LIST),
 	   "set_list_type ordered");
@@ -242,9 +242,9 @@ accessors(test_batch_runner *runner)
 
 	// Getter errors
 
-	INT_EQ(runner, cmark_node_get_header_level(bullet_list), 0,
-	       "get_header_level error");
-	INT_EQ(runner, cmark_node_get_list_type(header), CMARK_NO_LIST,
+	INT_EQ(runner, cmark_node_get_heading_level(bullet_list), 0,
+	       "get_heading_level error");
+	INT_EQ(runner, cmark_node_get_list_type(heading), CMARK_NO_LIST,
 	       "get_list_type error");
 	INT_EQ(runner, cmark_node_get_list_start(code), 0,
 	       "get_list_start error");
@@ -256,14 +256,14 @@ accessors(test_batch_runner *runner)
 	   "get_fence_info error");
 	OK(runner, cmark_node_get_url(html) == NULL,
 	   "get_url error");
-	OK(runner, cmark_node_get_title(header) == NULL,
+	OK(runner, cmark_node_get_title(heading) == NULL,
 	   "get_title error");
 
 	// Setter errors
 
-	OK(runner, !cmark_node_set_header_level(bullet_list, 3),
-	   "set_header_level error");
-	OK(runner, !cmark_node_set_list_type(header, CMARK_ORDERED_LIST),
+	OK(runner, !cmark_node_set_heading_level(bullet_list, 3),
+	   "set_heading_level error");
+	OK(runner, !cmark_node_set_list_type(heading, CMARK_ORDERED_LIST),
 	   "set_list_type error");
 	OK(runner, !cmark_node_set_list_start(code, 3),
 	   "set_list_start error");
@@ -275,13 +275,13 @@ accessors(test_batch_runner *runner)
 	   "set_fence_info error");
 	OK(runner, !cmark_node_set_url(html, "url"),
 	   "set_url error");
-	OK(runner, !cmark_node_set_title(header, "title"),
+	OK(runner, !cmark_node_set_title(heading, "title"),
 	   "set_title error");
 
-	OK(runner, !cmark_node_set_header_level(header, 0),
-	   "set_header_level too small");
-	OK(runner, !cmark_node_set_header_level(header, 7),
-	   "set_header_level too large");
+	OK(runner, !cmark_node_set_heading_level(heading, 0),
+	   "set_heading_level too small");
+	OK(runner, !cmark_node_set_heading_level(heading, 7),
+	   "set_heading_level too large");
 	OK(runner, !cmark_node_set_list_type(bullet_list, CMARK_NO_LIST),
 	   "set_list_type invalid");
 	OK(runner, !cmark_node_set_list_start(bullet_list, -1),
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3
@@ -1,4 +1,4 @@
-.TH cmark 3 "December 19, 2015" "LOCAL" "Library Functions Manual"
+.TH cmark 3 "December 22, 2015" "LOCAL" "Library Functions Manual"
 .SH
 NAME
 .PP
@@ -88,7 +88,7 @@ of \f[C]CMARK_EVENT_EXIT\f[]). The iterator will return
 natural application is an HTML renderer, where an \f[C]ENTER\f[] event
 outputs an open tag and an \f[C]EXIT\f[] event outputs a close tag. An
 iterator might also be used to transform an AST in some systematic way,
-for example, turning all level\-3 headers into regular paragraphs.
+for example, turning all level\-3 headings into regular paragraphs.
 .IP
 .nf
 \f[C]
@@ -221,17 +221,17 @@ Sets the string contents of \f[I]node\f[]. Returns 1 on success, 0 on
 failure.
 
 .PP
-\fIint\f[] \fBcmark_node_get_header_level\f[](\fIcmark_node *node\f[])
+\fIint\f[] \fBcmark_node_get_heading_level\f[](\fIcmark_node *node\f[])
 
 .PP
-Returns the header level of \f[I]node\f[], or 0 if \f[I]node\f[] is not
-a header.
+Returns the heading level of \f[I]node\f[], or 0 if \f[I]node\f[] is not
+a heading.
 
 .PP
-\fIint\f[] \fBcmark_node_set_header_level\f[](\fIcmark_node *node\f[], \fIint level\f[])
+\fIint\f[] \fBcmark_node_set_heading_level\f[](\fIcmark_node *node\f[], \fIint level\f[])
 
 .PP
-Sets the header level of \f[I]node\f[], returning 1 on success and 0 on
+Sets the heading level of \f[I]node\f[], returning 1 on success and 0 on
 error.
 
 .PP
diff --git a/src/blocks.c b/src/blocks.c
@@ -208,7 +208,7 @@ static cmark_node *finalize(cmark_parser *parser, cmark_node *b) {
     b->end_column = parser->last_line_length;
   } else if (b->type == CMARK_NODE_DOCUMENT ||
              (b->type == CMARK_NODE_CODE_BLOCK && b->as.code.fenced) ||
-             (b->type == CMARK_NODE_HEADER && b->as.header.setext)) {
+             (b->type == CMARK_NODE_HEADER && b->as.heading.setext)) {
     b->end_line = parser->line_number;
     b->end_column = parser->curline->size;
     if (b->end_column && parser->curline->ptr[b->end_column - 1] == '\n')
@@ -687,7 +687,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
       }
     } else if (container->type == CMARK_NODE_HEADER) {
 
-      // a header can never contain more than one line
+      // a heading can never contain more than one line
       all_matched = false;
 
     } else if (container->type == CMARK_NODE_HTML) {
@@ -750,7 +750,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
       container = add_child(parser, container, CMARK_NODE_BLOCK_QUOTE,
                             parser->offset + 1);
 
-    } else if (!indented && (matched = scan_atx_header_start(
+    } else if (!indented && (matched = scan_atx_heading_start(
                                  &input, parser->first_nonspace))) {
 
       S_advance_offset(parser, &input,
@@ -767,8 +767,8 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
         level++;
         hashpos++;
       }
-      container->as.header.level = level;
-      container->as.header.setext = false;
+      container->as.heading.level = level;
+      container->as.heading.setext = false;
 
     } else if (!indented && (matched = scan_open_code_fence(
                                  &input, parser->first_nonspace))) {
@@ -799,22 +799,22 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
 
     } else if (!indented && container->type == CMARK_NODE_PARAGRAPH &&
                (lev =
-                    scan_setext_header_line(&input, parser->first_nonspace)) &&
+                    scan_setext_heading_line(&input, parser->first_nonspace)) &&
                // check that there is only one line in the paragraph:
                (cmark_strbuf_strrchr(
                     &container->string_content, '\n',
                     cmark_strbuf_len(&container->string_content) - 2) < 0)) {
 
       container->type = CMARK_NODE_HEADER;
-      container->as.header.level = lev;
-      container->as.header.setext = true;
+      container->as.heading.level = lev;
+      container->as.heading.setext = true;
       S_advance_offset(parser, &input, input.len - 1 - parser->offset, false);
 
     } else if (!indented &&
                !(container->type == CMARK_NODE_PARAGRAPH && !all_matched) &&
                (matched = scan_hrule(&input, parser->first_nonspace))) {
 
-      // it's only now that we know the line is not part of a setext header:
+      // it's only now that we know the line is not part of a setext heading:
       container = add_child(parser, container, CMARK_NODE_HRULE,
                             parser->first_nonspace + 1);
       S_advance_offset(parser, &input, input.len - 1 - parser->offset, false);
@@ -981,7 +981,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
     } else if (accepts_lines(container->type)) {
 
       if (container->type == CMARK_NODE_HEADER &&
-          container->as.header.setext == false) {
+          container->as.heading.setext == false) {
         chop_trailing_hashtags(&input);
       }
       add_line(container, &input, parser->first_nonspace);
diff --git a/src/cmark.h b/src/cmark.h
@@ -141,7 +141,7 @@ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
  * One natural application is an HTML renderer, where an `ENTER` event
  * outputs an open tag and an `EXIT` event outputs a close tag.
  * An iterator might also be used to transform an AST in some systematic
- * way, for example, turning all level-3 headers into regular paragraphs.
+ * way, for example, turning all level-3 headings into regular paragraphs.
  *
  *     void
  *     usage_example(cmark_node *root) {
@@ -245,13 +245,17 @@ CMARK_EXPORT const char *cmark_node_get_literal(cmark_node *node);
  */
 CMARK_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content);
 
-/** Returns the header level of 'node', or 0 if 'node' is not a header.
+/** Returns the heading level of 'node', or 0 if 'node' is not a heading.
  */
-CMARK_EXPORT int cmark_node_get_header_level(cmark_node *node);
+CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node);
 
-/** Sets the header level of 'node', returning 1 on success and 0 on error.
+/* For backwards compatibility */
+#define cmark_node_get_header_level cmark_node_get_heading_level
+#define cmark_node_set_header_level cmark_node_set_heading_level
+
+/** Sets the heading level of 'node', returning 1 on success and 0 on error.
  */
-CMARK_EXPORT int cmark_node_set_header_level(cmark_node *node, int level);
+CMARK_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level);
 
 /** Returns the list type of 'node', or `CMARK_NO_LIST` if 'node'
  * is not a list.
diff --git a/src/commonmark.c b/src/commonmark.c
@@ -230,7 +230,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
 
   case CMARK_NODE_HEADER:
     if (entering) {
-      for (i = cmark_node_get_header_level(node); i > 0; i--) {
+      for (i = cmark_node_get_heading_level(node); i > 0; i--) {
         LIT("#");
       }
       LIT(" ");
diff --git a/src/html.c b/src/html.c
@@ -43,8 +43,8 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
   cmark_node *parent;
   cmark_node *grandparent;
   cmark_strbuf *html = state->html;
-  char start_header[] = "<h0";
-  char end_header[] = "</h0";
+  char start_heading[] = "<h0";
+  char end_heading[] = "</h0";
   bool tight;
   char buffer[100];
 
@@ -130,13 +130,13 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
   case CMARK_NODE_HEADER:
     if (entering) {
       cr(html);
-      start_header[2] = (char)('0' + node->as.header.level);
-      cmark_strbuf_puts(html, start_header);
+      start_heading[2] = (char)('0' + node->as.heading.level);
+      cmark_strbuf_puts(html, start_heading);
       S_render_sourcepos(node, html, options);
       cmark_strbuf_putc(html, '>');
     } else {
-      end_header[3] = (char)('0' + node->as.header.level);
-      cmark_strbuf_puts(html, end_header);
+      end_heading[3] = (char)('0' + node->as.heading.level);
+      cmark_strbuf_puts(html, end_heading);
       cmark_strbuf_puts(html, ">\n");
     }
     break;
diff --git a/src/latex.c b/src/latex.c
@@ -266,7 +266,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
 
   case CMARK_NODE_HEADER:
     if (entering) {
-      switch (cmark_node_get_header_level(node)) {
+      switch (cmark_node_get_heading_level(node)) {
       case 1:
         LIT("\\section");
         break;
diff --git a/src/man.c b/src/man.c
@@ -123,7 +123,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
   case CMARK_NODE_HEADER:
     if (entering) {
       CR();
-      LIT(cmark_node_get_header_level(node) == 1 ? ".SH" : ".SS");
+      LIT(cmark_node_get_heading_level(node) == 1 ? ".SH" : ".SS");
       CR();
     } else {
       CR();
diff --git a/src/node.c b/src/node.c
@@ -74,7 +74,7 @@ cmark_node *cmark_node_new(cmark_node_type type) {
 
   switch (node->type) {
   case CMARK_NODE_HEADER:
-    node->as.header.level = 1;
+    node->as.heading.level = 1;
     break;
 
   case CMARK_NODE_LIST: {
@@ -173,7 +173,7 @@ const char *cmark_node_get_type_string(cmark_node *node) {
   case CMARK_NODE_PARAGRAPH:
     return "paragraph";
   case CMARK_NODE_HEADER:
-    return "header";
+    return "heading";
   case CMARK_NODE_HRULE:
     return "hrule";
   case CMARK_NODE_TEXT:
@@ -303,14 +303,14 @@ int cmark_node_set_literal(cmark_node *node, const char *content) {
   return 0;
 }
 
-int cmark_node_get_header_level(cmark_node *node) {
+int cmark_node_get_heading_level(cmark_node *node) {
   if (node == NULL) {
     return 0;
   }
 
   switch (node->type) {
   case CMARK_NODE_HEADER:
-    return node->as.header.level;
+    return node->as.heading.level;
 
   default:
     break;
@@ -319,14 +319,14 @@ int cmark_node_get_header_level(cmark_node *node) {
   return 0;
 }
 
-int cmark_node_set_header_level(cmark_node *node, int level) {
+int cmark_node_set_heading_level(cmark_node *node, int level) {
   if (node == NULL || level < 1 || level > 6) {
     return 0;
   }
 
   switch (node->type) {
   case CMARK_NODE_HEADER:
-    node->as.header.level = level;
+    node->as.heading.level = level;
     return 1;
 
   default:
diff --git a/src/node.h b/src/node.h
@@ -35,7 +35,7 @@ typedef struct {
 typedef struct {
   int level;
   bool setext;
-} cmark_header;
+} cmark_heading;
 
 typedef struct {
   cmark_chunk url;
@@ -72,7 +72,7 @@ struct cmark_node {
     cmark_chunk literal;
     cmark_list list;
     cmark_code code;
-    cmark_header header;
+    cmark_heading heading;
     cmark_link link;
     cmark_custom custom;
     int html_block_type;
diff --git a/src/scanners.c b/src/scanners.c
@@ -15128,37 +15128,45 @@ bufsize_t _scan_html_tag(const unsigned char *p) {
     unsigned char yych;
     static const unsigned char yybm[] = {
         /* table 1 .. 8: 0 */
-        0, 230, 230, 230, 230, 230, 230, 230, 230, 199, 199, 199, 199, 199, 230,
+        0,   230, 230, 230, 230, 230, 230, 230, 230, 199, 199, 199, 199, 199,
         230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
-        230, 230, 230, 199, 230, 70, 230, 230, 230, 230, 134, 230, 230, 230,
-        230, 230, 254, 246, 230, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-        254, 246, 230, 198, 198, 196, 230, 230, 254, 254, 254, 254, 254, 254,
+        230, 230, 230, 230, 199, 230, 70,  230, 230, 230, 230, 134, 230, 230,
+        230, 230, 230, 254, 246, 230, 254, 254, 254, 254, 254, 254, 254, 254,
+        254, 254, 246, 230, 198, 198, 196, 230, 230, 254, 254, 254, 254, 254,
         254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-        254, 254, 254, 254, 254, 254, 230, 230, 226, 230, 246, 198, 254, 254,
+        254, 254, 254, 254, 254, 254, 254, 230, 230, 226, 230, 246, 198, 254,
         254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
-        254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 230, 230, 230, 230,
-        230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+        254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 230, 230, 230,
+        230, 230, 0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,
         /* table 9 .. 11: 256 */
-        0, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+        0,   160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
         160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
         160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-        160, 160, 32, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-        160, 160, 160, 160, 160, 160, 128, 160, 224, 224, 224, 224, 224, 224,
+        160, 160, 160, 32,  160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+        160, 160, 160, 160, 160, 160, 160, 128, 160, 224, 224, 224, 224, 224,
         224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
-        224, 224, 224, 224, 224, 224, 160, 160, 160, 160, 160, 160, 160, 160,
+        224, 224, 224, 224, 224, 224, 224, 160, 160, 160, 160, 160, 160, 160,
         160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
         160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-        160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+        160, 160, 0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,
     };
     yych = *(marker = p);
     if (yych <= '`') {
@@ -25077,8 +25085,8 @@ bufsize_t _scan_spacechars(const unsigned char *p) {
   }
 }
 
-// Match ATX header start.
-bufsize_t _scan_atx_header_start(const unsigned char *p) {
+// Match ATX heading start.
+bufsize_t _scan_atx_heading_start(const unsigned char *p) {
   const unsigned char *marker = NULL;
   const unsigned char *start = p;
 
@@ -25277,9 +25285,9 @@ bufsize_t _scan_atx_header_start(const unsigned char *p) {
   }
 }
 
-// Match setext header line.  Return 1 for level-1 header,
+// Match setext heading line.  Return 1 for level-1 heading,
 // 2 for level-2, 0 for no match.
-bufsize_t _scan_setext_header_line(const unsigned char *p) {
+bufsize_t _scan_setext_heading_line(const unsigned char *p) {
   const unsigned char *marker = NULL;
 
   {
diff --git a/src/scanners.h b/src/scanners.h
@@ -21,8 +21,8 @@ bufsize_t _scan_html_block_end_5(const unsigned char *p);
 bufsize_t _scan_link_url(const unsigned char *p);
 bufsize_t _scan_link_title(const unsigned char *p);
 bufsize_t _scan_spacechars(const unsigned char *p);
-bufsize_t _scan_atx_header_start(const unsigned char *p);
-bufsize_t _scan_setext_header_line(const unsigned char *p);
+bufsize_t _scan_atx_heading_start(const unsigned char *p);
+bufsize_t _scan_setext_heading_line(const unsigned char *p);
 bufsize_t _scan_hrule(const unsigned char *p);
 bufsize_t _scan_open_code_fence(const unsigned char *p);
 bufsize_t _scan_close_code_fence(const unsigned char *p);
@@ -43,8 +43,8 @@ bufsize_t _scan_dangerous_url(const unsigned char *p);
 #define scan_link_url(c, n) _scan_at(&_scan_link_url, c, n)
 #define scan_link_title(c, n) _scan_at(&_scan_link_title, c, n)
 #define scan_spacechars(c, n) _scan_at(&_scan_spacechars, c, n)
-#define scan_atx_header_start(c, n) _scan_at(&_scan_atx_header_start, c, n)
-#define scan_setext_header_line(c, n) _scan_at(&_scan_setext_header_line, c, n)
+#define scan_atx_heading_start(c, n) _scan_at(&_scan_atx_heading_start, c, n)
+#define scan_setext_heading_line(c, n) _scan_at(&_scan_setext_heading_line, c, n)
 #define scan_hrule(c, n) _scan_at(&_scan_hrule, c, n)
 #define scan_open_code_fence(c, n) _scan_at(&_scan_open_code_fence, c, n)
 #define scan_close_code_fence(c, n) _scan_at(&_scan_close_code_fence, c, n)
diff --git a/src/scanners.re b/src/scanners.re
@@ -247,8 +247,8 @@ bufsize_t _scan_spacechars(const unsigned char *p)
 */
 }
 
-// Match ATX header start.
-bufsize_t _scan_atx_header_start(const unsigned char *p)
+// Match ATX heading start.
+bufsize_t _scan_atx_heading_start(const unsigned char *p)
 {
   const unsigned char *marker = NULL;
   const unsigned char *start = p;
@@ -258,9 +258,9 @@ bufsize_t _scan_atx_header_start(const unsigned char *p)
 */
 }
 
-// Match setext header line.  Return 1 for level-1 header,
+// Match setext heading line.  Return 1 for level-1 heading,
 // 2 for level-2, 0 for no match.
-bufsize_t _scan_setext_header_line(const unsigned char *p)
+bufsize_t _scan_setext_heading_line(const unsigned char *p)
 {
   const unsigned char *marker = NULL;
 /*!re2c
diff --git a/src/xml.c b/src/xml.c
@@ -87,7 +87,7 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,
       cmark_strbuf_puts(xml, buffer);
       break;
     case CMARK_NODE_HEADER:
-      sprintf(buffer, " level=\"%d\"", node->as.header.level);
+      sprintf(buffer, " level=\"%d\"", node->as.heading.level);
       cmark_strbuf_puts(xml, buffer);
       break;
     case CMARK_NODE_CODE_BLOCK: