cmark
My personal build of CMark ✏️
- Commit
- 4811dc3ec2330f015444ac6f5ee4f8cbf3563808
- Parent
- de6c5fb2c45dfa2791074f7d99a27b23b2106dfc
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Rename hrule -> thematic_break.
CMARK_NODE_HRULE -> CMARK_NODE_THEMATIC_BREAK.
However we've defined the former as the latter to keep
backwards compatibility.
See jgm/CommonMark 8fa94cb460f5e516b0e57adca33f50a669d51f6c
Diffstat
13 files changed, 25 insertions, 23 deletions
diff --git a/api_test/main.c b/api_test/main.c
@@ -20,7 +20,7 @@ static const cmark_node_type node_types[] = {
CMARK_NODE_HTML,
CMARK_NODE_PARAGRAPH,
CMARK_NODE_HEADING,
- CMARK_NODE_HRULE,
+ CMARK_NODE_THEMATIC_BREAK,
CMARK_NODE_TEXT,
CMARK_NODE_SOFTBREAK,
CMARK_NODE_LINEBREAK,
@@ -516,7 +516,7 @@ hierarchy(test_batch_runner *runner)
(1 << CMARK_NODE_HTML) |
(1 << CMARK_NODE_PARAGRAPH) |
(1 << CMARK_NODE_HEADING) |
- (1 << CMARK_NODE_HRULE);
+ (1 << CMARK_NODE_THEMATIC_BREAK);
int all_inlines =
(1 << CMARK_NODE_TEXT) |
(1 << CMARK_NODE_SOFTBREAK) |
@@ -536,7 +536,7 @@ hierarchy(test_batch_runner *runner)
test_content(runner, CMARK_NODE_HTML, 0);
test_content(runner, CMARK_NODE_PARAGRAPH, all_inlines);
test_content(runner, CMARK_NODE_HEADING, all_inlines);
- test_content(runner, CMARK_NODE_HRULE, 0);
+ test_content(runner, CMARK_NODE_THEMATIC_BREAK, 0);
test_content(runner, CMARK_NODE_TEXT, 0);
test_content(runner, CMARK_NODE_SOFTBREAK, 0);
test_content(runner, CMARK_NODE_LINEBREAK, 0);
diff --git a/src/blocks.c b/src/blocks.c
@@ -812,10 +812,10 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
} else if (!indented &&
!(container->type == CMARK_NODE_PARAGRAPH && !all_matched) &&
- (matched = scan_hrule(&input, parser->first_nonspace))) {
+ (matched = scan_thematic_break(&input, parser->first_nonspace))) {
// it's only now that we know the line is not part of a setext heading:
- container = add_child(parser, container, CMARK_NODE_HRULE,
+ container = add_child(parser, container, CMARK_NODE_THEMATIC_BREAK,
parser->first_nonspace + 1);
S_advance_offset(parser, &input, input.len - 1 - parser->offset, false);
@@ -902,7 +902,7 @@ static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
container->last_line_blank =
(parser->blank && container->type != CMARK_NODE_BLOCK_QUOTE &&
container->type != CMARK_NODE_HEADING &&
- container->type != CMARK_NODE_HRULE &&
+ container->type != CMARK_NODE_THEMATIC_BREAK &&
!(container->type == CMARK_NODE_CODE_BLOCK &&
container->as.code.fenced) &&
!(container->type == CMARK_NODE_ITEM && container->first_child == NULL &&
diff --git a/src/cmark.h b/src/cmark.h
@@ -43,10 +43,10 @@ typedef enum {
CMARK_NODE_CUSTOM_BLOCK,
CMARK_NODE_PARAGRAPH,
CMARK_NODE_HEADING,
- CMARK_NODE_HRULE,
+ CMARK_NODE_THEMATIC_BREAK,
CMARK_NODE_FIRST_BLOCK = CMARK_NODE_DOCUMENT,
- CMARK_NODE_LAST_BLOCK = CMARK_NODE_HRULE,
+ CMARK_NODE_LAST_BLOCK = CMARK_NODE_THEMATIC_BREAK,
/* Inline */
CMARK_NODE_TEXT,
@@ -66,6 +66,7 @@ typedef enum {
/* For backwards compatibility: */
#define CMARK_NODE_HEADER CMARK_NODE_HEADING
+#define CMARK_NODE_HRULE CMARK_NODE_THEMATIC_BREAK
typedef enum {
CMARK_NO_LIST,
@@ -163,7 +164,7 @@ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
* of type:
*
* * CMARK_NODE_HTML
- * * CMARK_NODE_HRULE
+ * * CMARK_NODE_THEMATIC_BREAK
* * CMARK_NODE_CODE_BLOCK
* * CMARK_NODE_TEXT
* * CMARK_NODE_SOFTBREAK
@@ -553,6 +554,7 @@ const char *cmark_version_string();
#define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH
#define NODE_HEADING CMARK_NODE_HEADING
#define NODE_HEADER CMARK_NODE_HEADER
+#define NODE_THEMATIC_BREAK CMARK_NODE_THEMATIC_BREAK
#define NODE_HRULE CMARK_NODE_HRULE
#define NODE_TEXT CMARK_NODE_TEXT
#define NODE_SOFTBREAK CMARK_NODE_SOFTBREAK
diff --git a/src/scanners.h b/src/scanners.h
@@ -23,7 +23,7 @@ bufsize_t _scan_link_title(const unsigned char *p);
bufsize_t _scan_spacechars(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_thematic_break(const unsigned char *p);
bufsize_t _scan_open_code_fence(const unsigned char *p);
bufsize_t _scan_close_code_fence(const unsigned char *p);
bufsize_t _scan_entity(const unsigned char *p);
@@ -45,7 +45,7 @@ bufsize_t _scan_dangerous_url(const unsigned char *p);
#define scan_spacechars(c, n) _scan_at(&_scan_spacechars, 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_thematic_break(c, n) _scan_at(&_scan_thematic_break, 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)
#define scan_entity(c, n) _scan_at(&_scan_entity, c, n)