github-markdown 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/markdown/autolink.c +2 -2
- data/ext/markdown/markdown.c +27 -6
- data/ext/markdown/plaintext.c +1 -7
- data/github-markdown.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28fa8ed9daf6133d7ec96ffe630eced45affce35
|
4
|
+
data.tar.gz: 58e12eaab9d955409da483d909de7d9b7a875560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d4aae8a213ec9c0a54d99a8e9e6e200e367876b3a911715adcab3b99b1cb927b722e2318064243cb597d190d7a2750a55f11f068b53f3876c29f51581f56de9
|
7
|
+
data.tar.gz: 8c40378c643ec6548bc4efabc358db9d0ba4d0f50c5dec32d2614d86358df123f04be19cedf4fa8ca4bf797fb379997170eae4eacd5bda403f9c1cba17e13941
|
data/ext/markdown/autolink.c
CHANGED
@@ -61,7 +61,7 @@ autolink_delim(uint8_t *data, size_t link_end, size_t max_rewind, size_t size)
|
|
61
61
|
}
|
62
62
|
|
63
63
|
while (link_end > 0) {
|
64
|
-
if (strchr("
|
64
|
+
if (strchr("?!.,:", data[link_end - 1]) != NULL)
|
65
65
|
link_end--;
|
66
66
|
|
67
67
|
else if (data[link_end - 1] == ';') {
|
@@ -110,7 +110,7 @@ autolink_delim(uint8_t *data, size_t link_end, size_t max_rewind, size_t size)
|
|
110
110
|
* => http://www.pokemon.com/Pikachu_(Electric)
|
111
111
|
*
|
112
112
|
* foo http://www.pokemon.com/Pikachu_(Electric)) bar
|
113
|
-
* => http://www.pokemon.com/Pikachu_(Electric)
|
113
|
+
* => http://www.pokemon.com/Pikachu_(Electric)
|
114
114
|
*
|
115
115
|
* (foo http://www.pokemon.com/Pikachu_(Electric)) bar
|
116
116
|
* => foo http://www.pokemon.com/Pikachu_(Electric)
|
data/ext/markdown/markdown.c
CHANGED
@@ -233,6 +233,15 @@ free_link_refs(struct link_ref **references)
|
|
233
233
|
}
|
234
234
|
}
|
235
235
|
|
236
|
+
/*
|
237
|
+
Wrap isalnum so that characters outside of the ASCII range don't count.
|
238
|
+
*/
|
239
|
+
static inline int
|
240
|
+
_isalnum(int c)
|
241
|
+
{
|
242
|
+
return isalnum(c) && c < 0x7f;
|
243
|
+
}
|
244
|
+
|
236
245
|
/*
|
237
246
|
* Check whether a char is a Markdown space.
|
238
247
|
|
@@ -299,14 +308,14 @@ tag_length(uint8_t *data, size_t size, enum mkd_autolink *autolink)
|
|
299
308
|
if (data[0] != '<') return 0;
|
300
309
|
i = (data[1] == '/') ? 2 : 1;
|
301
310
|
|
302
|
-
if (!
|
311
|
+
if (!_isalnum(data[i]))
|
303
312
|
return 0;
|
304
313
|
|
305
314
|
/* scheme test */
|
306
315
|
*autolink = MKDA_NOT_AUTOLINK;
|
307
316
|
|
308
317
|
/* try to find the beginning of an URI */
|
309
|
-
while (i < size && (
|
318
|
+
while (i < size && (_isalnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-'))
|
310
319
|
i++;
|
311
320
|
|
312
321
|
if (i > 1 && data[i] == '@') {
|
@@ -501,7 +510,7 @@ parse_emph1(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size
|
|
501
510
|
if (data[i] == c && !_isspace(data[i - 1])) {
|
502
511
|
|
503
512
|
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
|
504
|
-
if (i + 1 < size && data[i]
|
513
|
+
if (i + 1 < size && (_isalnum(data[i + 1]) || data[i + 1] == c))
|
505
514
|
continue;
|
506
515
|
}
|
507
516
|
|
@@ -536,6 +545,12 @@ parse_emph2(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size
|
|
536
545
|
i += len;
|
537
546
|
|
538
547
|
if (i + 1 < size && data[i] == c && data[i + 1] == c && i && !_isspace(data[i - 1])) {
|
548
|
+
|
549
|
+
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
|
550
|
+
if (i + 2 < size && (_isalnum(data[i + 2]) || data[i + 2] == c))
|
551
|
+
continue;
|
552
|
+
}
|
553
|
+
|
539
554
|
work = rndr_newbuf(rndr, BUFFER_SPAN);
|
540
555
|
parse_inline(work, rndr, data, i);
|
541
556
|
r = render_method(ob, work, rndr->opaque);
|
@@ -565,6 +580,12 @@ parse_emph3(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size
|
|
565
580
|
continue;
|
566
581
|
|
567
582
|
if (i + 2 < size && data[i + 1] == c && data[i + 2] == c && rndr->cb.triple_emphasis) {
|
583
|
+
|
584
|
+
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
|
585
|
+
if (i + 3 < size && (_isalnum(data[i + 3]) || data[i + 3] == c))
|
586
|
+
continue;
|
587
|
+
}
|
588
|
+
|
568
589
|
/* triple symbol found */
|
569
590
|
struct buf *work = rndr_newbuf(rndr, BUFFER_SPAN);
|
570
591
|
|
@@ -597,7 +618,7 @@ char_emphasis(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t of
|
|
597
618
|
size_t ret;
|
598
619
|
|
599
620
|
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
|
600
|
-
if (offset > 0 && !_isspace(data[-1]) && (
|
621
|
+
if (offset > 0 && !_isspace(data[-1]) && (_isalnum(data[-1]) || data[-1] == data[0])) {
|
601
622
|
return 0;
|
602
623
|
}
|
603
624
|
}
|
@@ -722,7 +743,7 @@ char_entity(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offs
|
|
722
743
|
if (end < size && data[end] == '#')
|
723
744
|
end++;
|
724
745
|
|
725
|
-
while (end < size &&
|
746
|
+
while (end < size && _isalnum(data[end]))
|
726
747
|
end++;
|
727
748
|
|
728
749
|
if (end < size && data[end] == ';')
|
@@ -1470,7 +1491,7 @@ parse_paragraph(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t
|
|
1470
1491
|
* let's check to see if there's some kind of block starting
|
1471
1492
|
* here
|
1472
1493
|
*/
|
1473
|
-
if ((rndr->ext_flags & MKDEXT_LAX_SPACING) && !
|
1494
|
+
if ((rndr->ext_flags & MKDEXT_LAX_SPACING) && !_isalnum(data[i])) {
|
1474
1495
|
if (prefix_oli(data + i, size - i) ||
|
1475
1496
|
prefix_uli(data + i, size - i)) {
|
1476
1497
|
end = i;
|
data/ext/markdown/plaintext.c
CHANGED
@@ -109,12 +109,6 @@ rndr_paragraph(struct buf *ob, const struct buf *text, void *opaque)
|
|
109
109
|
plaintext_block(ob, text);
|
110
110
|
}
|
111
111
|
|
112
|
-
static void
|
113
|
-
rndr_raw_block(struct buf *ob, const struct buf *text, void *opaque)
|
114
|
-
{
|
115
|
-
/* NO OP */
|
116
|
-
}
|
117
|
-
|
118
112
|
static void
|
119
113
|
rndr_hrule(struct buf *ob, void *opaque)
|
120
114
|
{
|
@@ -159,7 +153,7 @@ sdtext_renderer(struct sd_callbacks *callbacks)
|
|
159
153
|
static const struct sd_callbacks cb_default = {
|
160
154
|
rndr_blockcode,
|
161
155
|
rndr_blockquote,
|
162
|
-
|
156
|
+
NULL,
|
163
157
|
rndr_header,
|
164
158
|
rndr_hrule,
|
165
159
|
rndr_list,
|
data/github-markdown.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'github-markdown'
|
4
|
-
s.version = '0.6.
|
4
|
+
s.version = '0.6.5'
|
5
5
|
s.summary = 'The Markdown parser for GitHub.com'
|
6
6
|
s.description = 'Self-contained Markdown parser for GitHub, with all our custom extensions'
|
7
7
|
s.date = '2013-10-01'
|