commonmarker 0.23.6 → 1.0.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +70 -212
  3. data/commonmarker.gemspec +34 -31
  4. data/ext/commonmarker/Cargo.toml +12 -0
  5. data/ext/commonmarker/_util.rb +102 -0
  6. data/ext/commonmarker/extconf.rb +4 -5
  7. data/ext/commonmarker/src/comrak_options.rs +107 -0
  8. data/ext/commonmarker/src/lib.rs +27 -0
  9. data/lib/commonmarker/config.rb +58 -37
  10. data/lib/commonmarker/extension.rb +14 -0
  11. data/lib/commonmarker/renderer.rb +1 -127
  12. data/lib/commonmarker/version.rb +2 -2
  13. data/lib/commonmarker.rb +19 -32
  14. metadata +33 -177
  15. data/Rakefile +0 -109
  16. data/bin/commonmarker +0 -118
  17. data/ext/commonmarker/arena.c +0 -103
  18. data/ext/commonmarker/autolink.c +0 -456
  19. data/ext/commonmarker/autolink.h +0 -8
  20. data/ext/commonmarker/blocks.c +0 -1596
  21. data/ext/commonmarker/buffer.c +0 -278
  22. data/ext/commonmarker/buffer.h +0 -116
  23. data/ext/commonmarker/case_fold_switch.inc +0 -4327
  24. data/ext/commonmarker/chunk.h +0 -135
  25. data/ext/commonmarker/cmark-gfm-core-extensions.h +0 -54
  26. data/ext/commonmarker/cmark-gfm-extension_api.h +0 -736
  27. data/ext/commonmarker/cmark-gfm-extensions_export.h +0 -42
  28. data/ext/commonmarker/cmark-gfm.h +0 -817
  29. data/ext/commonmarker/cmark-gfm_export.h +0 -42
  30. data/ext/commonmarker/cmark-gfm_version.h +0 -7
  31. data/ext/commonmarker/cmark.c +0 -55
  32. data/ext/commonmarker/cmark_ctype.c +0 -44
  33. data/ext/commonmarker/cmark_ctype.h +0 -33
  34. data/ext/commonmarker/commonmark.c +0 -529
  35. data/ext/commonmarker/commonmarker.c +0 -1307
  36. data/ext/commonmarker/commonmarker.h +0 -16
  37. data/ext/commonmarker/config.h +0 -76
  38. data/ext/commonmarker/core-extensions.c +0 -27
  39. data/ext/commonmarker/entities.inc +0 -2138
  40. data/ext/commonmarker/ext_scanners.c +0 -879
  41. data/ext/commonmarker/ext_scanners.h +0 -24
  42. data/ext/commonmarker/footnotes.c +0 -63
  43. data/ext/commonmarker/footnotes.h +0 -27
  44. data/ext/commonmarker/houdini.h +0 -57
  45. data/ext/commonmarker/houdini_href_e.c +0 -100
  46. data/ext/commonmarker/houdini_html_e.c +0 -66
  47. data/ext/commonmarker/houdini_html_u.c +0 -149
  48. data/ext/commonmarker/html.c +0 -486
  49. data/ext/commonmarker/html.h +0 -27
  50. data/ext/commonmarker/inlines.c +0 -1716
  51. data/ext/commonmarker/inlines.h +0 -29
  52. data/ext/commonmarker/iterator.c +0 -159
  53. data/ext/commonmarker/iterator.h +0 -26
  54. data/ext/commonmarker/latex.c +0 -466
  55. data/ext/commonmarker/linked_list.c +0 -37
  56. data/ext/commonmarker/man.c +0 -278
  57. data/ext/commonmarker/map.c +0 -122
  58. data/ext/commonmarker/map.h +0 -41
  59. data/ext/commonmarker/node.c +0 -979
  60. data/ext/commonmarker/node.h +0 -125
  61. data/ext/commonmarker/parser.h +0 -58
  62. data/ext/commonmarker/plaintext.c +0 -235
  63. data/ext/commonmarker/plugin.c +0 -36
  64. data/ext/commonmarker/plugin.h +0 -34
  65. data/ext/commonmarker/references.c +0 -42
  66. data/ext/commonmarker/references.h +0 -26
  67. data/ext/commonmarker/registry.c +0 -63
  68. data/ext/commonmarker/registry.h +0 -24
  69. data/ext/commonmarker/render.c +0 -205
  70. data/ext/commonmarker/render.h +0 -62
  71. data/ext/commonmarker/scanners.c +0 -10508
  72. data/ext/commonmarker/scanners.h +0 -62
  73. data/ext/commonmarker/scanners.re +0 -341
  74. data/ext/commonmarker/strikethrough.c +0 -167
  75. data/ext/commonmarker/strikethrough.h +0 -9
  76. data/ext/commonmarker/syntax_extension.c +0 -149
  77. data/ext/commonmarker/syntax_extension.h +0 -34
  78. data/ext/commonmarker/table.c +0 -848
  79. data/ext/commonmarker/table.h +0 -12
  80. data/ext/commonmarker/tagfilter.c +0 -60
  81. data/ext/commonmarker/tagfilter.h +0 -8
  82. data/ext/commonmarker/tasklist.c +0 -156
  83. data/ext/commonmarker/tasklist.h +0 -8
  84. data/ext/commonmarker/utf8.c +0 -317
  85. data/ext/commonmarker/utf8.h +0 -35
  86. data/ext/commonmarker/xml.c +0 -181
  87. data/lib/commonmarker/node/inspect.rb +0 -47
  88. data/lib/commonmarker/node.rb +0 -83
  89. data/lib/commonmarker/renderer/html_renderer.rb +0 -252
@@ -1,135 +0,0 @@
1
- #ifndef CMARK_CHUNK_H
2
- #define CMARK_CHUNK_H
3
-
4
- #include <string.h>
5
- #include <stdlib.h>
6
- #include <assert.h>
7
- #include "cmark-gfm.h"
8
- #include "buffer.h"
9
- #include "cmark_ctype.h"
10
-
11
- #define CMARK_CHUNK_EMPTY \
12
- { NULL, 0, 0 }
13
-
14
- typedef struct cmark_chunk {
15
- unsigned char *data;
16
- bufsize_t len;
17
- bufsize_t alloc; // also implies a NULL-terminated string
18
- } cmark_chunk;
19
-
20
- static CMARK_INLINE void cmark_chunk_free(cmark_mem *mem, cmark_chunk *c) {
21
- if (c->alloc)
22
- mem->free(c->data);
23
-
24
- c->data = NULL;
25
- c->alloc = 0;
26
- c->len = 0;
27
- }
28
-
29
- static CMARK_INLINE void cmark_chunk_ltrim(cmark_chunk *c) {
30
- assert(!c->alloc);
31
-
32
- while (c->len && cmark_isspace(c->data[0])) {
33
- c->data++;
34
- c->len--;
35
- }
36
- }
37
-
38
- static CMARK_INLINE void cmark_chunk_rtrim(cmark_chunk *c) {
39
- assert(!c->alloc);
40
-
41
- while (c->len > 0) {
42
- if (!cmark_isspace(c->data[c->len - 1]))
43
- break;
44
-
45
- c->len--;
46
- }
47
- }
48
-
49
- static CMARK_INLINE void cmark_chunk_trim(cmark_chunk *c) {
50
- cmark_chunk_ltrim(c);
51
- cmark_chunk_rtrim(c);
52
- }
53
-
54
- static CMARK_INLINE bufsize_t cmark_chunk_strchr(cmark_chunk *ch, int c,
55
- bufsize_t offset) {
56
- const unsigned char *p =
57
- (unsigned char *)memchr(ch->data + offset, c, ch->len - offset);
58
- return p ? (bufsize_t)(p - ch->data) : ch->len;
59
- }
60
-
61
- static CMARK_INLINE const char *cmark_chunk_to_cstr(cmark_mem *mem,
62
- cmark_chunk *c) {
63
- unsigned char *str;
64
-
65
- if (c->alloc) {
66
- return (char *)c->data;
67
- }
68
- str = (unsigned char *)mem->calloc(c->len + 1, 1);
69
- if (c->len > 0) {
70
- memcpy(str, c->data, c->len);
71
- }
72
- str[c->len] = 0;
73
- c->data = str;
74
- c->alloc = 1;
75
-
76
- return (char *)str;
77
- }
78
-
79
- static CMARK_INLINE void cmark_chunk_set_cstr(cmark_mem *mem, cmark_chunk *c,
80
- const char *str) {
81
- unsigned char *old = c->alloc ? c->data : NULL;
82
- if (str == NULL) {
83
- c->len = 0;
84
- c->data = NULL;
85
- c->alloc = 0;
86
- } else {
87
- c->len = (bufsize_t)strlen(str);
88
- c->data = (unsigned char *)mem->calloc(c->len + 1, 1);
89
- c->alloc = 1;
90
- memcpy(c->data, str, c->len + 1);
91
- }
92
- if (old != NULL) {
93
- mem->free(old);
94
- }
95
- }
96
-
97
- static CMARK_INLINE cmark_chunk cmark_chunk_literal(const char *data) {
98
- bufsize_t len = data ? (bufsize_t)strlen(data) : 0;
99
- cmark_chunk c = {(unsigned char *)data, len, 0};
100
- return c;
101
- }
102
-
103
- static CMARK_INLINE cmark_chunk cmark_chunk_dup(const cmark_chunk *ch,
104
- bufsize_t pos, bufsize_t len) {
105
- cmark_chunk c = {ch->data + pos, len, 0};
106
- return c;
107
- }
108
-
109
- static CMARK_INLINE cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf) {
110
- cmark_chunk c;
111
-
112
- c.len = buf->size;
113
- c.data = cmark_strbuf_detach(buf);
114
- c.alloc = 1;
115
-
116
- return c;
117
- }
118
-
119
- /* trim_new variants are to be used when the source chunk may or may not be
120
- * allocated; forces a newly allocated chunk. */
121
- static CMARK_INLINE cmark_chunk cmark_chunk_ltrim_new(cmark_mem *mem, cmark_chunk *c) {
122
- cmark_chunk r = cmark_chunk_dup(c, 0, c->len);
123
- cmark_chunk_ltrim(&r);
124
- cmark_chunk_to_cstr(mem, &r);
125
- return r;
126
- }
127
-
128
- static CMARK_INLINE cmark_chunk cmark_chunk_rtrim_new(cmark_mem *mem, cmark_chunk *c) {
129
- cmark_chunk r = cmark_chunk_dup(c, 0, c->len);
130
- cmark_chunk_rtrim(&r);
131
- cmark_chunk_to_cstr(mem, &r);
132
- return r;
133
- }
134
-
135
- #endif
@@ -1,54 +0,0 @@
1
- #ifndef CMARK_GFM_CORE_EXTENSIONS_H
2
- #define CMARK_GFM_CORE_EXTENSIONS_H
3
-
4
- #ifdef __cplusplus
5
- extern "C" {
6
- #endif
7
-
8
- #include "cmark-gfm-extension_api.h"
9
- #include "cmark-gfm-extensions_export.h"
10
- #include "config.h" // for bool
11
- #include <stdint.h>
12
-
13
- CMARK_GFM_EXTENSIONS_EXPORT
14
- void cmark_gfm_core_extensions_ensure_registered(void);
15
-
16
- CMARK_GFM_EXTENSIONS_EXPORT
17
- uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node);
18
-
19
- /** Sets the number of columns for the table, returning 1 on success and 0 on error.
20
- */
21
- CMARK_GFM_EXTENSIONS_EXPORT
22
- int cmark_gfm_extensions_set_table_columns(cmark_node *node, uint16_t n_columns);
23
-
24
- CMARK_GFM_EXTENSIONS_EXPORT
25
- uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node);
26
-
27
- /** Sets the alignments for the table, returning 1 on success and 0 on error.
28
- */
29
- CMARK_GFM_EXTENSIONS_EXPORT
30
- int cmark_gfm_extensions_set_table_alignments(cmark_node *node, uint16_t ncols, uint8_t *alignments);
31
-
32
- CMARK_GFM_EXTENSIONS_EXPORT
33
- int cmark_gfm_extensions_get_table_row_is_header(cmark_node *node);
34
-
35
- /** Sets whether the node is a table header row, returning 1 on success and 0 on error.
36
- */
37
- CMARK_GFM_EXTENSIONS_EXPORT
38
- int cmark_gfm_extensions_set_table_row_is_header(cmark_node *node, int is_header);
39
-
40
- CMARK_GFM_EXTENSIONS_EXPORT
41
- bool cmark_gfm_extensions_get_tasklist_item_checked(cmark_node *node);
42
- /* For backwards compatibility */
43
- #define cmark_gfm_extensions_tasklist_is_checked cmark_gfm_extensions_get_tasklist_item_checked
44
-
45
- /** Sets whether a tasklist item is "checked" (completed), returning 1 on success and 0 on error.
46
- */
47
- CMARK_GFM_EXTENSIONS_EXPORT
48
- int cmark_gfm_extensions_set_tasklist_item_checked(cmark_node *node, bool is_checked);
49
-
50
- #ifdef __cplusplus
51
- }
52
- #endif
53
-
54
- #endif