commonmarker 0.14.14 → 0.15.0
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/commonmarker.gemspec +2 -0
- data/ext/commonmarker/cmark/Makefile +13 -8
- data/ext/commonmarker/cmark/README.md +18 -11
- data/ext/commonmarker/cmark/api_test/CMakeLists.txt +1 -1
- data/ext/commonmarker/cmark/extensions/CMakeLists.txt +7 -7
- data/ext/commonmarker/cmark/extensions/ext_scanners.c +562 -3
- data/ext/commonmarker/cmark/extensions/ext_scanners.h +6 -0
- data/ext/commonmarker/cmark/extensions/ext_scanners.re +32 -0
- data/ext/commonmarker/cmark/extensions/table.c +87 -215
- data/ext/commonmarker/cmark/man/CMakeLists.txt +2 -2
- data/ext/commonmarker/cmark/man/make_man_page.py +3 -3
- data/ext/commonmarker/cmark/man/man1/{cmark.1 → cmark-gfm.1} +10 -4
- data/ext/commonmarker/cmark/man/man3/{cmark.3 → cmark-gfm.3} +2 -2
- data/ext/commonmarker/cmark/src/CMakeLists.txt +15 -15
- data/ext/commonmarker/cmark/src/buffer.c +5 -1
- data/ext/commonmarker/cmark/src/cmark.c +6 -2
- data/ext/commonmarker/cmark/src/cmark.h +1 -1
- data/ext/commonmarker/cmark/src/cmark_extension_api.h +0 -2
- data/ext/commonmarker/cmark/src/commonmark.c +1 -2
- data/ext/commonmarker/cmark/src/inlines.c +1 -1
- data/ext/commonmarker/cmark/src/libcmark-gfm.pc.in +10 -0
- data/ext/commonmarker/cmark/src/main.c +2 -2
- data/ext/commonmarker/cmark/src/render.c +15 -0
- data/ext/commonmarker/cmark/test/CMakeLists.txt +5 -5
- data/ext/commonmarker/cmark/test/cmark.py +2 -2
- data/ext/commonmarker/cmark/test/extensions.txt +24 -3
- data/ext/commonmarker/cmark/test/roundtrip_tests.py +1 -0
- data/ext/commonmarker/cmark/test/spec.txt +84 -15
- data/ext/commonmarker/cmark/test/spec_tests.py +9 -8
- data/ext/commonmarker/cmark/tools/Dockerfile +36 -0
- data/ext/commonmarker/extconf.rb +5 -5
- data/lib/commonmarker/node/inspect.rb +59 -0
- data/lib/commonmarker/node.rb +3 -0
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_node.rb +8 -0
- data/test/test_spec.rb +1 -1
- metadata +10 -6
- data/ext/commonmarker/cmark/src/libcmark.pc.in +0 -10
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "utf8.h"
|
|
6
6
|
#include "render.h"
|
|
7
7
|
#include "node.h"
|
|
8
|
+
#include "syntax_extension.h"
|
|
8
9
|
|
|
9
10
|
static CMARK_INLINE void S_cr(cmark_renderer *renderer) {
|
|
10
11
|
if (renderer->need_cr < 1) {
|
|
@@ -30,6 +31,16 @@ static void S_out(cmark_renderer *renderer, cmark_node *node,
|
|
|
30
31
|
cmark_chunk remainder = cmark_chunk_literal("");
|
|
31
32
|
int k = renderer->buffer->size - 1;
|
|
32
33
|
|
|
34
|
+
cmark_syntax_extension *ext = NULL;
|
|
35
|
+
cmark_node *n = node;
|
|
36
|
+
while (n && !ext) {
|
|
37
|
+
ext = n->extension;
|
|
38
|
+
if (!ext)
|
|
39
|
+
n = n->parent;
|
|
40
|
+
}
|
|
41
|
+
if (ext && !ext->commonmark_escape_func)
|
|
42
|
+
ext = NULL;
|
|
43
|
+
|
|
33
44
|
wrap = wrap && !renderer->no_linebreaks;
|
|
34
45
|
|
|
35
46
|
if (renderer->in_tight_list_item && renderer->need_cr > 1) {
|
|
@@ -63,6 +74,10 @@ static void S_out(cmark_renderer *renderer, cmark_node *node,
|
|
|
63
74
|
if (len == -1) { // error condition
|
|
64
75
|
return; // return without rendering rest of string
|
|
65
76
|
}
|
|
77
|
+
|
|
78
|
+
if (ext && ext->commonmark_escape_func(ext, node, c))
|
|
79
|
+
cmark_strbuf_putc(renderer->buffer, '\\');
|
|
80
|
+
|
|
66
81
|
nextc = source[i + len];
|
|
67
82
|
if (c == 32 && wrap) {
|
|
68
83
|
if (!renderer->begin_line) {
|
|
@@ -55,22 +55,22 @@ IF (PYTHONINTERP_FOUND)
|
|
|
55
55
|
endif()
|
|
56
56
|
|
|
57
57
|
add_test(spectest_executable
|
|
58
|
-
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
|
|
58
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/spec.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark-gfm"
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
add_test(smartpuncttest_executable
|
|
62
|
-
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/smart_punct.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark --smart"
|
|
62
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/smart_punct.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark-gfm --smart"
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
add_test(extensions_executable
|
|
66
|
-
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/extensions.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark" "--extensions" "table strikethrough autolink tagfilter"
|
|
66
|
+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec" "${CMAKE_CURRENT_SOURCE_DIR}/extensions.txt" "--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark-gfm" "--extensions" "table strikethrough autolink tagfilter"
|
|
67
67
|
)
|
|
68
68
|
|
|
69
69
|
add_test(roundtrip_extensions_executable
|
|
70
70
|
${PYTHON_EXECUTABLE}
|
|
71
71
|
"${CMAKE_CURRENT_SOURCE_DIR}/roundtrip_tests.py"
|
|
72
72
|
"--spec" "${CMAKE_CURRENT_SOURCE_DIR}/extensions.txt"
|
|
73
|
-
"--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
|
|
73
|
+
"--program" "${CMAKE_CURRENT_BINARY_DIR}/../src/cmark-gfm"
|
|
74
74
|
"--extensions" "table strikethrough autolink tagfilter"
|
|
75
75
|
)
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ IF (PYTHONINTERP_FOUND)
|
|
|
78
78
|
${PYTHON_EXECUTABLE}
|
|
79
79
|
"${CMAKE_CURRENT_SOURCE_DIR}/spec_tests.py" "--no-normalize" "--spec"
|
|
80
80
|
"${CMAKE_CURRENT_SOURCE_DIR}/regression.txt" "--program"
|
|
81
|
-
"${CMAKE_CURRENT_BINARY_DIR}/../src/cmark"
|
|
81
|
+
"${CMAKE_CURRENT_BINARY_DIR}/../src/cmark-gfm"
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
|
|
@@ -94,13 +94,13 @@ class CMark:
|
|
|
94
94
|
if not library_dir:
|
|
95
95
|
library_dir = os.path.join("build", "src")
|
|
96
96
|
for prefix, suffix in libnames:
|
|
97
|
-
candidate = os.path.join(library_dir, prefix + "cmark" + suffix)
|
|
97
|
+
candidate = os.path.join(library_dir, prefix + "cmark-gfm" + suffix)
|
|
98
98
|
if os.path.isfile(candidate):
|
|
99
99
|
libpath = candidate
|
|
100
100
|
break
|
|
101
101
|
cmark = CDLL(libpath)
|
|
102
102
|
extlib = CDLL(os.path.join(
|
|
103
|
-
library_dir, "..", "extensions", prefix + "
|
|
103
|
+
library_dir, "..", "extensions", prefix + "cmark-gfmextensions" + suffix))
|
|
104
104
|
self.to_html = lambda x, exts=[]: to_html(cmark, extlib, x, exts + self.extensions)
|
|
105
105
|
self.to_commonmark = lambda x, exts=[]: to_commonmark(cmark, extlib, x, exts + self.extensions)
|
|
106
106
|
|
|
@@ -254,8 +254,8 @@ Tables with embedded pipes could be tricky.
|
|
|
254
254
|
| a | b |
|
|
255
255
|
| --- | --- |
|
|
256
256
|
| Escaped pipes are \|okay\|. | Like \| this. |
|
|
257
|
-
| Within
|
|
258
|
-
| _**`c
|
|
257
|
+
| Within `\|code\| is okay` too. |
|
|
258
|
+
| _**`c\|`**_ \| complex
|
|
259
259
|
| don't **\_reparse\_**
|
|
260
260
|
.
|
|
261
261
|
<table>
|
|
@@ -344,7 +344,7 @@ This shouldn't assert.
|
|
|
344
344
|
</tr>
|
|
345
345
|
<tr>
|
|
346
346
|
<td>|</td>
|
|
347
|
-
<td><code
|
|
347
|
+
<td><code>|</code></td>
|
|
348
348
|
</tr>
|
|
349
349
|
<tr>
|
|
350
350
|
<td>\a</td>
|
|
@@ -427,6 +427,27 @@ Here's a link to [Freedom Planet 2][].
|
|
|
427
427
|
</tr></tbody></table>
|
|
428
428
|
````````````````````````````````
|
|
429
429
|
|
|
430
|
+
### Interaction with emphasis
|
|
431
|
+
|
|
432
|
+
```````````````````````````````` example
|
|
433
|
+
| a | b |
|
|
434
|
+
| --- | --- |
|
|
435
|
+
|***(a)***|
|
|
436
|
+
.
|
|
437
|
+
<table>
|
|
438
|
+
<thead>
|
|
439
|
+
<tr>
|
|
440
|
+
<th>a</th>
|
|
441
|
+
<th>b</th>
|
|
442
|
+
</tr>
|
|
443
|
+
</thead>
|
|
444
|
+
<tbody>
|
|
445
|
+
<tr>
|
|
446
|
+
<td><em><strong>(a)</strong></em></td>
|
|
447
|
+
<td></td>
|
|
448
|
+
</tr></tbody></table>
|
|
449
|
+
````````````````````````````````
|
|
450
|
+
|
|
430
451
|
|
|
431
452
|
## Strikethroughs
|
|
432
453
|
|
|
@@ -46,4 +46,5 @@ result_counts = {'pass': 0, 'fail': 0, 'error': 0, 'skip': 0}
|
|
|
46
46
|
for test in tests:
|
|
47
47
|
do_test(converter, test, args.normalize, result_counts)
|
|
48
48
|
|
|
49
|
+
sys.stdout.buffer.write("{pass} passed, {fail} failed, {error} errored, {skip} skipped\n".format(**result_counts).encode('utf-8'))
|
|
49
50
|
exit(result_counts['fail'] + result_counts['error'])
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
author: John MacFarlane
|
|
2
|
+
title: GitHub Flavored Markdown Spec
|
|
4
3
|
version: 0.27
|
|
5
|
-
date: '
|
|
4
|
+
date: '2017-2-20'
|
|
6
5
|
license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)'
|
|
7
6
|
...
|
|
8
7
|
|
|
9
8
|
# Introduction
|
|
10
9
|
|
|
10
|
+
## What is GitHub Flavored Markdown?
|
|
11
|
+
|
|
12
|
+
GitHub Flavored Markdown, often shortened as GFM, is the dialect of Markdown
|
|
13
|
+
that is currently supported for user content on GitHub.com and GitHub
|
|
14
|
+
Enterprise.
|
|
15
|
+
|
|
16
|
+
This formal specification, based on the CommonMark Spec, defines the syntax and
|
|
17
|
+
semantics of this dialect.
|
|
18
|
+
|
|
19
|
+
GFM is a strict superset of CommonMark. All the features which are supported in
|
|
20
|
+
GitHub user content and that are not specified on the original CommonMark Spec
|
|
21
|
+
are hence known as **extensions**, and highlighted as such.
|
|
22
|
+
|
|
11
23
|
## What is Markdown?
|
|
12
24
|
|
|
13
25
|
Markdown is a plain text format for writing structured documents,
|
|
@@ -3165,8 +3177,8 @@ aaa
|
|
|
3165
3177
|
|
|
3166
3178
|
## Tables (extension)
|
|
3167
3179
|
|
|
3168
|
-
|
|
3169
|
-
available
|
|
3180
|
+
GFM enables the `table` extension, where an additional leaf block type is
|
|
3181
|
+
available.
|
|
3170
3182
|
|
|
3171
3183
|
A [table](@) is an arrangement of data with rows and columns, consisting of a
|
|
3172
3184
|
single header row, a [delimiter row] separating the header from the data, and
|
|
@@ -3223,14 +3235,14 @@ bar | baz
|
|
|
3223
3235
|
</tr></tbody></table>
|
|
3224
3236
|
````````````````````````````````
|
|
3225
3237
|
|
|
3226
|
-
Include a pipe in a cell's content by escaping it
|
|
3227
|
-
spans
|
|
3238
|
+
Include a pipe in a cell's content by escaping it, including inside other
|
|
3239
|
+
inline spans:
|
|
3228
3240
|
|
|
3229
3241
|
```````````````````````````````` example table
|
|
3230
3242
|
| f\|oo |
|
|
3231
3243
|
| ------ |
|
|
3232
|
-
| b
|
|
3233
|
-
| b
|
|
3244
|
+
| b `\|` az |
|
|
3245
|
+
| b **\|** im |
|
|
3234
3246
|
.
|
|
3235
3247
|
<table>
|
|
3236
3248
|
<thead>
|
|
@@ -3314,8 +3326,8 @@ a table will not be recognized:
|
|
|
3314
3326
|
````````````````````````````````
|
|
3315
3327
|
|
|
3316
3328
|
The remainder of the table's rows may vary in the number of cells. If there
|
|
3317
|
-
are a number of cells than the
|
|
3318
|
-
greater, the excess is ignored:
|
|
3329
|
+
are a number of cells fewer than the number of cells in the header row, empty
|
|
3330
|
+
cells are inserted. If there are greater, the excess is ignored:
|
|
3319
3331
|
|
|
3320
3332
|
```````````````````````````````` example table
|
|
3321
3333
|
| abc | def |
|
|
@@ -4907,6 +4919,63 @@ that in such cases, we require one space indentation from the list marker
|
|
|
4907
4919
|
four-space rule in cases where the list marker plus its initial indentation
|
|
4908
4920
|
takes four spaces (a common case), but diverge in other cases.
|
|
4909
4921
|
|
|
4922
|
+
<div class="extension">
|
|
4923
|
+
|
|
4924
|
+
## Task list items (extension)
|
|
4925
|
+
|
|
4926
|
+
GFM enables the `tasklist` extension, where an additional processing step is
|
|
4927
|
+
performed on [list items].
|
|
4928
|
+
|
|
4929
|
+
A [task list item](@) is a [list item][list items] where the first block in it
|
|
4930
|
+
is a paragraph which begins with a [task list item marker] and at least one
|
|
4931
|
+
whitespace character before any other content.
|
|
4932
|
+
|
|
4933
|
+
A [task list item marker](@) consists of an optional number of spaces, a left
|
|
4934
|
+
bracket (`[`), either a whitespace character or the letter `x` in either
|
|
4935
|
+
lowercase or uppercase, and then a right bracket (`]`).
|
|
4936
|
+
|
|
4937
|
+
When rendered, the [task list item marker] is replaced with a semantic checkbox element;
|
|
4938
|
+
in an HTML output, this would be an `<input type="checkbox">` element.
|
|
4939
|
+
|
|
4940
|
+
If the character between the brackets is a whitespace character, the checkbox
|
|
4941
|
+
is unchecked. Otherwise, the checkbox is checked.
|
|
4942
|
+
|
|
4943
|
+
This spec does not define how the checkbox elements are interacted with: in practice,
|
|
4944
|
+
implementors are free to render the checkboxes as disabled or inmutable elements,
|
|
4945
|
+
or they may dynamically handle dynamic interactions (i.e. checking, unchecking) in
|
|
4946
|
+
the final rendered document.
|
|
4947
|
+
|
|
4948
|
+
```````````````````````````````` example disabled
|
|
4949
|
+
- [ ] foo
|
|
4950
|
+
- [x] bar
|
|
4951
|
+
.
|
|
4952
|
+
<ul>
|
|
4953
|
+
<li><input disabled="" type="checkbox"> foo</li>
|
|
4954
|
+
<li><input checked="" disabled="" type="checkbox"> bar</li>
|
|
4955
|
+
</ul>
|
|
4956
|
+
````````````````````````````````
|
|
4957
|
+
|
|
4958
|
+
Task lists can be arbitrarily nested:
|
|
4959
|
+
|
|
4960
|
+
```````````````````````````````` example disabled
|
|
4961
|
+
- [x] foo
|
|
4962
|
+
- [ ] bar
|
|
4963
|
+
- [x] baz
|
|
4964
|
+
- [ ] bim
|
|
4965
|
+
.
|
|
4966
|
+
<ul>
|
|
4967
|
+
<li><input checked="" disabled="" type="checkbox"> foo
|
|
4968
|
+
<ul>
|
|
4969
|
+
<li><input disabled="" type="checkbox"> bar</li>
|
|
4970
|
+
<li><input checked="" disabled="" type="checkbox"> baz</li>
|
|
4971
|
+
</ul>
|
|
4972
|
+
</li>
|
|
4973
|
+
<li><input disabled="" type="checkbox"> bim</li>
|
|
4974
|
+
</ul>
|
|
4975
|
+
````````````````````````````````
|
|
4976
|
+
|
|
4977
|
+
</div>
|
|
4978
|
+
|
|
4910
4979
|
## Lists
|
|
4911
4980
|
|
|
4912
4981
|
A [list](@) is a sequence of one or more
|
|
@@ -7292,7 +7361,7 @@ __a<http://foo.bar/?q=__>
|
|
|
7292
7361
|
|
|
7293
7362
|
## Strikethrough (extension)
|
|
7294
7363
|
|
|
7295
|
-
|
|
7364
|
+
GFM enables the `strikethrough` extension, where an additional emphasis type is
|
|
7296
7365
|
available.
|
|
7297
7366
|
|
|
7298
7367
|
Strikethrough text is any text wrapped in tildes (`~`).
|
|
@@ -8750,7 +8819,7 @@ foo@bar.example.com
|
|
|
8750
8819
|
|
|
8751
8820
|
## Autolinks (extension)
|
|
8752
8821
|
|
|
8753
|
-
|
|
8822
|
+
GFM enables the `autolink` extension, where autolinks will be recognised in a
|
|
8754
8823
|
greater number of conditions.
|
|
8755
8824
|
|
|
8756
8825
|
[Autolink]s can also be constructed without requiring the use of `<` and to `>`
|
|
@@ -9179,9 +9248,9 @@ foo <a href="\*">
|
|
|
9179
9248
|
|
|
9180
9249
|
<div class="extension">
|
|
9181
9250
|
|
|
9182
|
-
## Raw HTML (extension)
|
|
9251
|
+
## Disallowed Raw HTML (extension)
|
|
9183
9252
|
|
|
9184
|
-
|
|
9253
|
+
GFM enables the `tagfilter` extension, where the following HTML tags will be
|
|
9185
9254
|
filtered when rendering HTML output:
|
|
9186
9255
|
|
|
9187
9256
|
* `<title>`
|
|
@@ -104,14 +104,15 @@ def get_tests(specfile):
|
|
|
104
104
|
state = 0
|
|
105
105
|
example_number = example_number + 1
|
|
106
106
|
end_line = line_number
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
if 'disabled' not in extensions:
|
|
108
|
+
tests.append({
|
|
109
|
+
"markdown":''.join(markdown_lines).replace('→',"\t"),
|
|
110
|
+
"html":''.join(html_lines).replace('→',"\t"),
|
|
111
|
+
"example": example_number,
|
|
112
|
+
"start_line": start_line,
|
|
113
|
+
"end_line": end_line,
|
|
114
|
+
"section": headertext,
|
|
115
|
+
"extensions": extensions})
|
|
115
116
|
start_line = 0
|
|
116
117
|
markdown_lines = []
|
|
117
118
|
html_lines = []
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
FROM debian:jessie
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && apt-get install -y \
|
|
4
|
+
build-essential autoconf libtool \
|
|
5
|
+
git \
|
|
6
|
+
pkg-config \
|
|
7
|
+
&& apt-get clean
|
|
8
|
+
|
|
9
|
+
RUN apt-get install -y \
|
|
10
|
+
cmake \
|
|
11
|
+
gdb \
|
|
12
|
+
valgrind \
|
|
13
|
+
python3
|
|
14
|
+
|
|
15
|
+
RUN apt-get install -y \
|
|
16
|
+
wget \
|
|
17
|
+
clang
|
|
18
|
+
|
|
19
|
+
RUN wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz && \
|
|
20
|
+
tar xf afl-latest.tgz && \
|
|
21
|
+
cd afl-* && \
|
|
22
|
+
make install && \
|
|
23
|
+
cd .. && \
|
|
24
|
+
rm -rf afl-*
|
|
25
|
+
|
|
26
|
+
RUN apt-get install -y man
|
|
27
|
+
|
|
28
|
+
RUN wget https://github.com/skvadrik/re2c/releases/download/0.15.3/re2c-0.15.3.tar.gz && \
|
|
29
|
+
tar xf re2c-0.15.3.tar.gz && \
|
|
30
|
+
cd re2c-* && \
|
|
31
|
+
./configure && \
|
|
32
|
+
make install && \
|
|
33
|
+
cd .. && \
|
|
34
|
+
rm -rf re2c-*
|
|
35
|
+
|
|
36
|
+
RUN apt-get install -y clang-format-3.5
|
data/ext/commonmarker/extconf.rb
CHANGED
|
@@ -28,8 +28,8 @@ Dir.chdir(CMARK_BUILD_DIR) do
|
|
|
28
28
|
else
|
|
29
29
|
system 'cmake .. -DCMAKE_C_FLAGS=-fPIC'
|
|
30
30
|
end
|
|
31
|
-
system "make
|
|
32
|
-
system "make
|
|
31
|
+
system "make libcmark-gfm_static" or abort "make libcmark-gfm_static failed"
|
|
32
|
+
system "make libcmark-gfmextensions_static" or abort "make libcmark-gfmextensions_static failed"
|
|
33
33
|
# rake-compiler seems to complain about this line, not sure why it's messing with it
|
|
34
34
|
FileUtils.rm_rf(File.join(CMARK_BUILD_DIR, 'Testing', 'Temporary'))
|
|
35
35
|
end
|
|
@@ -41,11 +41,11 @@ dir_config('cmark', HEADER_DIRS, LIB_DIRS)
|
|
|
41
41
|
|
|
42
42
|
# don't even bother to do this check if using OS X's messed up system Ruby: http://git.io/vsxkn
|
|
43
43
|
unless sitearch =~ /^universal-darwin/
|
|
44
|
-
abort 'libcmark is missing.' unless find_library('cmark', 'cmark_parse_document')
|
|
45
|
-
abort '
|
|
44
|
+
abort 'libcmark-gfm is missing.' unless find_library('cmark-gfm', 'cmark_parse_document')
|
|
45
|
+
abort 'libcmark-gfmextensions is missing.' unless find_library('cmark-gfmextensions', 'core_extensions_registration')
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
$LDFLAGS << " -L#{CMARK_BUILD_DIR}/src -L#{CMARK_BUILD_DIR}/extensions -lcmark -
|
|
48
|
+
$LDFLAGS << " -L#{CMARK_BUILD_DIR}/src -L#{CMARK_BUILD_DIR}/extensions -lcmark-gfm -lcmark-gfmextensions"
|
|
49
49
|
$CFLAGS << " -O2 -I#{CMARK_DIR}/src -I#{CMARK_DIR}/extensions -I#{CMARK_BUILD_DIR}/src -I#{CMARK_BUILD_DIR}/extensions"
|
|
50
50
|
$CFLAGS << " -DCMARK_STATIC_DEFINE -DCMARKEXTENSIONS_STATIC_DEFINE"
|
|
51
51
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'pp'
|
|
4
|
+
|
|
5
|
+
module CommonMarker
|
|
6
|
+
class Node
|
|
7
|
+
module Inspect
|
|
8
|
+
PP_INDENT_SIZE = 2
|
|
9
|
+
|
|
10
|
+
def inspect
|
|
11
|
+
PP.pp(self, String.new, Float::INFINITY)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @param [PrettyPrint] pp
|
|
15
|
+
def pretty_print(pp)
|
|
16
|
+
pp.group(PP_INDENT_SIZE, "#<#{self.class}(#{type}):", '>') do
|
|
17
|
+
pp.breakable
|
|
18
|
+
|
|
19
|
+
attrs = %i[
|
|
20
|
+
sourcepos
|
|
21
|
+
string_content
|
|
22
|
+
url
|
|
23
|
+
title
|
|
24
|
+
header_level
|
|
25
|
+
list_type
|
|
26
|
+
list_start
|
|
27
|
+
list_tight
|
|
28
|
+
fence_info
|
|
29
|
+
].map do |name|
|
|
30
|
+
begin
|
|
31
|
+
[name, __send__(name)]
|
|
32
|
+
rescue NodeError
|
|
33
|
+
nil
|
|
34
|
+
end
|
|
35
|
+
end.compact
|
|
36
|
+
|
|
37
|
+
pp.seplist(attrs) do |name, value|
|
|
38
|
+
pp.text "#{name}="
|
|
39
|
+
pp.pp value
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
if first_child
|
|
43
|
+
pp.breakable
|
|
44
|
+
pp.group(PP_INDENT_SIZE) do
|
|
45
|
+
children = []
|
|
46
|
+
node = first_child
|
|
47
|
+
while node
|
|
48
|
+
children << node
|
|
49
|
+
node = node.next
|
|
50
|
+
end
|
|
51
|
+
pp.text 'children='
|
|
52
|
+
pp.pp children
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/commonmarker/node.rb
CHANGED
data/lib/commonmarker/version.rb
CHANGED
data/test/test_node.rb
CHANGED
|
@@ -78,4 +78,12 @@ class TestNode < Minitest::Test
|
|
|
78
78
|
end
|
|
79
79
|
assert_equal "<p>Hi there, I am mostly text!</p>\n", @doc.to_html
|
|
80
80
|
end
|
|
81
|
+
|
|
82
|
+
def test_inspect
|
|
83
|
+
assert_match /#<CommonMarker::Node\(document\):/, @doc.inspect
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_pretty_print
|
|
87
|
+
assert_match /#<CommonMarker::Node\(document\):/, PP.pp(@doc, '')
|
|
88
|
+
end
|
|
81
89
|
end
|
data/test/test_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ class TestSpec < Minitest::Test
|
|
|
5
5
|
spec = open_spec_file('spec.txt')
|
|
6
6
|
|
|
7
7
|
spec.each do |testcase|
|
|
8
|
-
|
|
8
|
+
next if testcase[:extensions].include?(:disabled)
|
|
9
9
|
doc = CommonMarker.render_doc(testcase[:markdown], :DEFAULT, testcase[:extensions])
|
|
10
10
|
|
|
11
11
|
define_method("test_to_html_example_#{testcase[:example]}") do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: commonmarker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Garen Torikian
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-
|
|
12
|
+
date: 2017-04-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ruby-enum
|
|
@@ -182,8 +182,8 @@ files:
|
|
|
182
182
|
- ext/commonmarker/cmark/extensions/tagfilter.h
|
|
183
183
|
- ext/commonmarker/cmark/man/CMakeLists.txt
|
|
184
184
|
- ext/commonmarker/cmark/man/make_man_page.py
|
|
185
|
-
- ext/commonmarker/cmark/man/man1/cmark.1
|
|
186
|
-
- ext/commonmarker/cmark/man/man3/cmark.3
|
|
185
|
+
- ext/commonmarker/cmark/man/man1/cmark-gfm.1
|
|
186
|
+
- ext/commonmarker/cmark/man/man3/cmark-gfm.3
|
|
187
187
|
- ext/commonmarker/cmark/nmake.bat
|
|
188
188
|
- ext/commonmarker/cmark/src/CMakeLists.txt
|
|
189
189
|
- ext/commonmarker/cmark/src/arena.c
|
|
@@ -212,7 +212,7 @@ files:
|
|
|
212
212
|
- ext/commonmarker/cmark/src/iterator.c
|
|
213
213
|
- ext/commonmarker/cmark/src/iterator.h
|
|
214
214
|
- ext/commonmarker/cmark/src/latex.c
|
|
215
|
-
- ext/commonmarker/cmark/src/libcmark.pc.in
|
|
215
|
+
- ext/commonmarker/cmark/src/libcmark-gfm.pc.in
|
|
216
216
|
- ext/commonmarker/cmark/src/linked_list.c
|
|
217
217
|
- ext/commonmarker/cmark/src/main.c
|
|
218
218
|
- ext/commonmarker/cmark/src/man.c
|
|
@@ -298,6 +298,7 @@ files:
|
|
|
298
298
|
- ext/commonmarker/cmark/test/spec.txt
|
|
299
299
|
- ext/commonmarker/cmark/test/spec_tests.py
|
|
300
300
|
- ext/commonmarker/cmark/toolchain-mingw32.cmake
|
|
301
|
+
- ext/commonmarker/cmark/tools/Dockerfile
|
|
301
302
|
- ext/commonmarker/cmark/tools/appveyor-build.bat
|
|
302
303
|
- ext/commonmarker/cmark/tools/make_entities_inc.py
|
|
303
304
|
- ext/commonmarker/cmark/tools/mkcasefold.pl
|
|
@@ -311,6 +312,7 @@ files:
|
|
|
311
312
|
- lib/commonmarker.rb
|
|
312
313
|
- lib/commonmarker/config.rb
|
|
313
314
|
- lib/commonmarker/node.rb
|
|
315
|
+
- lib/commonmarker/node/inspect.rb
|
|
314
316
|
- lib/commonmarker/renderer.rb
|
|
315
317
|
- lib/commonmarker/renderer/html_renderer.rb
|
|
316
318
|
- lib/commonmarker/version.rb
|
|
@@ -337,7 +339,9 @@ licenses:
|
|
|
337
339
|
- MIT
|
|
338
340
|
metadata: {}
|
|
339
341
|
post_install_message:
|
|
340
|
-
rdoc_options:
|
|
342
|
+
rdoc_options:
|
|
343
|
+
- "-x"
|
|
344
|
+
- ext/commonmarker/cmark/.*
|
|
341
345
|
require_paths:
|
|
342
346
|
- lib
|
|
343
347
|
- ext
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
prefix=@CMAKE_INSTALL_PREFIX@
|
|
2
|
-
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
|
3
|
-
libdir=@CMAKE_INSTALL_PREFIX@/lib
|
|
4
|
-
includedir=@CMAKE_INSTALL_PREFIX@/include
|
|
5
|
-
|
|
6
|
-
Name: libcmark
|
|
7
|
-
Description: CommonMark parsing, rendering, and manipulation
|
|
8
|
-
Version: @PROJECT_VERSION@
|
|
9
|
-
Libs: -L${libdir} -lcmark
|
|
10
|
-
Cflags: -I${includedir}
|