diff options
-rw-r--r-- | man/man3/cmark.3 | 15 | ||||
-rw-r--r-- | src/cmark.h | 6 | ||||
-rw-r--r-- | src/commonmark.c | 2 | ||||
-rw-r--r-- | src/html.c | 10 | ||||
-rw-r--r-- | src/latex.c | 10 | ||||
-rw-r--r-- | src/man.c | 10 | ||||
-rw-r--r-- | src/node.c | 4 | ||||
-rw-r--r-- | src/xml.c | 2 |
8 files changed, 53 insertions, 6 deletions
diff --git a/man/man3/cmark.3 b/man/man3/cmark.3 index 26c0d89..9fa8d6e 100644 --- a/man/man3/cmark.3 +++ b/man/man3/cmark.3 @@ -1,4 +1,4 @@ -.TH cmark 3 "October 28, 2015" "LOCAL" "Library Functions Manual" +.TH cmark 3 "December 19, 2015" "LOCAL" "Library Functions Manual" .SH NAME .PP @@ -28,8 +28,8 @@ Creating and Destroying Nodes .PP Creates a new node of type \f[I]type\f[]. Note that the node may have -other required properties, which it is the caller\[cq]s responsibility -to assign. +other required properties, which it is the caller's responsibility to +assign. .PP \fIvoid\f[] \fBcmark_node_free\f[](\fIcmark_node *node\f[]) @@ -112,6 +112,8 @@ are nodes of type: .IP \[bu] 2 CMARK_NODE_HTML .IP \[bu] 2 +CMARK_NODE_RAW_BLOCK +.IP \[bu] 2 CMARK_NODE_HRULE .IP \[bu] 2 CMARK_NODE_CODE_BLOCK @@ -125,6 +127,8 @@ CMARK_NODE_LINEBREAK CMARK_NODE_CODE .IP \[bu] 2 CMARK_NODE_INLINE_HTML +.IP \[bu] 2 +CMARK_NODE_RAW_INLINE .PP Nodes must only be modified after an \f[C]EXIT\f[] event, or an \f[C]ENTER\f[] event for leaf nodes. @@ -285,8 +289,7 @@ Returns 1 if \f[I]node\f[] is a tight list, 0 otherwise. \fIint\f[] \fBcmark_node_set_list_tight\f[](\fIcmark_node *node\f[], \fIint tight\f[]) .PP -Sets the \[lq]tightness\[rq] of a list. Returns 1 on success, 0 on -failure. +Sets the "tightness" of a list. Returns 1 on success, 0 on failure. .PP \fIconst char *\f[] \fBcmark_node_get_fence_info\f[](\fIcmark_node *node\f[]) @@ -554,7 +557,7 @@ Normalize tree by consolidating adjacent text nodes. .fi .PP -Convert straight quotes to curly, \[em] to em dashes, \[en] to en +Convert straight quotes to curly, \-\-\- to em dashes, \-\- to en dashes. .PP diff --git a/src/cmark.h b/src/cmark.h index 79bfbc5..612440f 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -40,6 +40,7 @@ typedef enum { CMARK_NODE_ITEM, CMARK_NODE_CODE_BLOCK, CMARK_NODE_HTML, + CMARK_NODE_RAW_BLOCK, CMARK_NODE_PARAGRAPH, CMARK_NODE_HEADER, CMARK_NODE_HRULE, @@ -53,6 +54,7 @@ typedef enum { CMARK_NODE_LINEBREAK, CMARK_NODE_CODE, CMARK_NODE_INLINE_HTML, + CMARK_NODE_RAW_INLINE, CMARK_NODE_EMPH, CMARK_NODE_STRONG, CMARK_NODE_LINK, @@ -158,6 +160,7 @@ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); * of type: * * * CMARK_NODE_HTML + * * CMARK_NODE_RAW_BLOCK * * CMARK_NODE_HRULE * * CMARK_NODE_CODE_BLOCK * * CMARK_NODE_TEXT @@ -165,6 +168,7 @@ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); * * CMARK_NODE_LINEBREAK * * CMARK_NODE_CODE * * CMARK_NODE_INLINE_HTML + * * CMARK_NODE_RAW_INLINE * * Nodes must only be modified after an `EXIT` event, or an `ENTER` event for * leaf nodes. @@ -514,6 +518,7 @@ const char *cmark_version_string(); #define NODE_ITEM CMARK_NODE_ITEM #define NODE_CODE_BLOCK CMARK_NODE_CODE_BLOCK #define NODE_HTML CMARK_NODE_HTML +#define NODE_RAW_BLOCK CMARK_NODE_RAW_BLOCK #define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH #define NODE_HEADER CMARK_NODE_HEADER #define NODE_HRULE CMARK_NODE_HRULE @@ -522,6 +527,7 @@ const char *cmark_version_string(); #define NODE_LINEBREAK CMARK_NODE_LINEBREAK #define NODE_CODE CMARK_NODE_CODE #define NODE_INLINE_HTML CMARK_NODE_INLINE_HTML +#define NODE_RAW_INLINE CMARK_NODE_RAW_INLINE #define NODE_EMPH CMARK_NODE_EMPH #define NODE_STRONG CMARK_NODE_STRONG #define NODE_LINK CMARK_NODE_LINK diff --git a/src/commonmark.c b/src/commonmark.c index cbf99c1..32b09a1 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -280,6 +280,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, break; case CMARK_NODE_HTML: + case CMARK_NODE_RAW_BLOCK: BLANKLINE(); OUT(cmark_node_get_literal(node), false, LITERAL); BLANKLINE(); @@ -336,6 +337,7 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, break; case CMARK_NODE_INLINE_HTML: + case CMARK_NODE_RAW_INLINE: OUT(cmark_node_get_literal(node), false, LITERAL); break; @@ -176,6 +176,12 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, cr(html); break; + case CMARK_NODE_RAW_BLOCK: + cr(html); + cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len); + cr(html); + break; + case CMARK_NODE_HRULE: cr(html); cmark_strbuf_puts(html, "<hr"); @@ -233,6 +239,10 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, } break; + case CMARK_NODE_RAW_INLINE: + cmark_strbuf_put(html, node->as.literal.data, node->as.literal.len); + break; + case CMARK_NODE_STRONG: if (entering) { cmark_strbuf_puts(html, "<strong>"); diff --git a/src/latex.c b/src/latex.c index 146062e..e7cb9f7 100644 --- a/src/latex.c +++ b/src/latex.c @@ -303,6 +303,12 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, case CMARK_NODE_HTML: break; + case CMARK_NODE_RAW_BLOCK: + CR(); + OUT(cmark_node_get_literal(node), false, LITERAL); + CR(); + break; + case CMARK_NODE_HRULE: BLANKLINE(); LIT("\\begin{center}\\rule{0.5\\linewidth}{\\linethickness}\\end{center}"); @@ -341,6 +347,10 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, case CMARK_NODE_INLINE_HTML: break; + case CMARK_NODE_RAW_INLINE: + OUT(cmark_node_get_literal(node), false, LITERAL); + break; + case CMARK_NODE_STRONG: if (entering) { LIT("\\textbf{"); @@ -142,6 +142,12 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, case CMARK_NODE_HTML: break; + case CMARK_NODE_RAW_BLOCK: + CR(); + OUT(cmark_node_get_literal(node), false, LITERAL); + CR(); + break; + case CMARK_NODE_HRULE: CR(); LIT(".PP\n * * * * *"); @@ -190,6 +196,10 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, case CMARK_NODE_INLINE_HTML: break; + case CMARK_NODE_RAW_INLINE: + OUT(cmark_node_get_literal(node), false, LITERAL); + break; + case CMARK_NODE_STRONG: if (entering) { LIT("\\f[B]"); @@ -161,6 +161,8 @@ const char *cmark_node_get_type_string(cmark_node *node) { return "code_block"; case CMARK_NODE_HTML: return "html"; + case CMARK_NODE_RAW_BLOCK: + return "raw_block"; case CMARK_NODE_PARAGRAPH: return "paragraph"; case CMARK_NODE_HEADER: @@ -177,6 +179,8 @@ const char *cmark_node_get_type_string(cmark_node *node) { return "code"; case CMARK_NODE_INLINE_HTML: return "inline_html"; + case CMARK_NODE_RAW_INLINE: + return "raw_inline"; case CMARK_NODE_EMPH: return "emph"; case CMARK_NODE_STRONG: @@ -53,7 +53,9 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type, case CMARK_NODE_TEXT: case CMARK_NODE_CODE: case CMARK_NODE_HTML: + case CMARK_NODE_RAW_BLOCK: case CMARK_NODE_INLINE_HTML: + case CMARK_NODE_RAW_INLINE: cmark_strbuf_puts(xml, ">"); escape_xml(xml, node->as.literal.data, node->as.literal.len); cmark_strbuf_puts(xml, "</"); |