rdiscount 2.2.7.2 → 2.2.7.4
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/BUILDING +2 -6
- data/CHANGELOG.md +126 -0
- data/Rakefile +9 -2
- data/ext/generate.c +6 -1
- data/ext/gethopt.c +1 -2
- data/ext/rdiscount.c +19 -3
- data/ext/toc.c +6 -1
- data/lib/rdiscount.rb +1 -1
- data/rdiscount.gemspec +2 -2
- data/test/rdiscount_test.rb +19 -0
- metadata +4 -8
- data/ext/ruby-config.h +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a482c6d06757896511681393e99f986552e02fd6735e55cf0f665a6543a058e
|
|
4
|
+
data.tar.gz: adc56e6fd1359cdfdd955f2262ecc18376c0d6a822d0476a713fe3cccb468991
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d244073c29884550875767cedbb065b760d1d690e51558f67429fe3516665e2ab5758298d3aaed68f5e1242c7a116afa00578cf7d89d067ab681eb3a08d1472
|
|
7
|
+
data.tar.gz: c2e1999790db93a98d6a5d65ea3f9a8ff1010e49fc678f5baba006f0af61f24123f05bfecc08649dbd13bdbe58198da855d9584bf0c42bd1b5b5217422c4a92e
|
data/BUILDING
CHANGED
|
@@ -47,13 +47,9 @@ Copy the new Discount sources to the appropriate directories for RDiscount:
|
|
|
47
47
|
|
|
48
48
|
$ rake gather
|
|
49
49
|
|
|
50
|
-
Update rdiscount.gemspec to include all *.c, *.h, and *.rb files in
|
|
51
|
-
ext. This must be done manually. Here's a quick way to get the full list:
|
|
50
|
+
Update rdiscount.gemspec to include all *.c, *.h, and *.rb files in ext:
|
|
52
51
|
|
|
53
|
-
$
|
|
54
|
-
|
|
55
|
-
(There is an old Rakefile target called "rdiscount.gemspec" that looks like it
|
|
56
|
-
is designed to perform an update of these files, however I haven't tested it.)
|
|
52
|
+
$ rake rdiscount.gemspec
|
|
57
53
|
|
|
58
54
|
Build the RDiscount gem. If you get errors related to missing files
|
|
59
55
|
in ext, make sure you updated the gemspec correctly in the previous step.
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# RDiscount Changelog
|
|
2
|
+
|
|
3
|
+
## Version 2.2.7.4 <small>(April 1, 2026)</small>
|
|
4
|
+
|
|
5
|
+
* Fix crash if `to_html` called on a string longer than INT_MAX (2 GiB of text).
|
|
6
|
+
|
|
7
|
+
## Version 2.2.7.3 <small>(December 31, 2023)</small>
|
|
8
|
+
|
|
9
|
+
* Add Ruby 3.2 and 3.3 to continuous integration
|
|
10
|
+
* Reinstate fix for compilation issue with Clang 16
|
|
11
|
+
|
|
12
|
+
## Version 2.2.7.2 <small>(December 19, 2023)</small>
|
|
13
|
+
|
|
14
|
+
* Discount upgraded from 2.2.7c -> 2.2.7d
|
|
15
|
+
* Fix compilation on openSUSE Tumbleweed
|
|
16
|
+
|
|
17
|
+
## Version 2.2.7.1 <small>(June 16, 2023)</small>
|
|
18
|
+
|
|
19
|
+
* Fix to not filter out `<style>` tags by default in Markdown output,
|
|
20
|
+
unless `filter_styles` is enabled
|
|
21
|
+
* Fix compilation issue with Clang 16
|
|
22
|
+
* Add TruffleRuby to continuous integration
|
|
23
|
+
|
|
24
|
+
## Version 2.2.7 <small>(October 23, 2022)</small>
|
|
25
|
+
|
|
26
|
+
* Discount upgraded from 2.2.0 -> 2.2.7c
|
|
27
|
+
* Implement support for :latex
|
|
28
|
+
* Implement support for :explicitlist
|
|
29
|
+
* Move CI to GitHub action and fix CI builds (Ruby 2.7 - 3.1)
|
|
30
|
+
* Drop support for all EOL Ruby versions (eg > 2.7)
|
|
31
|
+
* Fixing conformance tests to run version 1.0 and 1.0.3
|
|
32
|
+
|
|
33
|
+
## Version 2.2.0.2 <small>(August 9, 2020)</small>
|
|
34
|
+
|
|
35
|
+
* Fix compilation error on macOS Big Sur Preview (11.0).
|
|
36
|
+
* Enable continuous integration with Ruby 2.4-2.6.
|
|
37
|
+
* Builds with Ruby 2.7.0 locally but not on Travis CI.
|
|
38
|
+
|
|
39
|
+
## Version 2.2.0.1 <small>(May 7, 2016)</small>
|
|
40
|
+
|
|
41
|
+
* Discount upgraded from 2.1.8 -> 2.2.0
|
|
42
|
+
* Fix compilation error on MSVC (Windows).
|
|
43
|
+
* Enable continuous integration with Ruby 2.3.0.
|
|
44
|
+
|
|
45
|
+
## Version 2.1.8 <small>(February 1, 2015)</small>
|
|
46
|
+
|
|
47
|
+
* Compatible with Ruby 2.2.
|
|
48
|
+
* Discount upgraded from 2.1.7 -> 2.1.8
|
|
49
|
+
* GitHub-style language attributes on fenced code blocks.
|
|
50
|
+
* Long numeric list items.
|
|
51
|
+
* Fix footnote numbering inside of nested elements.
|
|
52
|
+
* Fix a bug where autolink + github flavored markdown absorbs the ^C eoln character into a link at the end of a line.
|
|
53
|
+
|
|
54
|
+
## Version 2.1.7.1 <small>(April 12, 2014)</small>
|
|
55
|
+
|
|
56
|
+
* Compatible with Xcode 5.1's clang on OS X.
|
|
57
|
+
|
|
58
|
+
## Version 2.1.7 <small>(October 13, 2013)</small>
|
|
59
|
+
|
|
60
|
+
* Discount upgraded from 2.1.6 -> 2.1.7
|
|
61
|
+
* GFM fenced code blocks support a language identifier.
|
|
62
|
+
* Definition lists:
|
|
63
|
+
* [Discount-style definition lists](http://www.pell.portland.or.us/~orc/Code/discount/#dl)
|
|
64
|
+
* [PHP Markdown Extra definition lists](http://michelf.ca/projects/php-markdown/extra/#def-list)
|
|
65
|
+
|
|
66
|
+
## Version 2.1.6 <small>(May 28, 2013)</small>
|
|
67
|
+
|
|
68
|
+
* Discount upgraded from 2.0.7 -> 2.1.6
|
|
69
|
+
* Fenced code blocks
|
|
70
|
+
* backtick-delimited – from GitHub Flavored Markdown
|
|
71
|
+
* tilde-delimited – from PHP Markdown Extra
|
|
72
|
+
* New extensions:
|
|
73
|
+
* `:no_superscript` - Disables superscript processing.
|
|
74
|
+
* `:no_strikethrough` - Disables strikethrough processing.
|
|
75
|
+
* License changed from 4-clause BSD to the more-permissive 3-clause BSD.
|
|
76
|
+
* Fix `--` and `---` to be converted to `–` and `—` correctly.
|
|
77
|
+
* Fix handling of tables that have leading and trailing pipe characters.
|
|
78
|
+
* Fix generated table of contents to be valid HTML.
|
|
79
|
+
Handling of special characters in headings is also improved.
|
|
80
|
+
* Fix recognition of HTML tags that contain - or _.
|
|
81
|
+
|
|
82
|
+
## Version 2.0.7.3 <small>(May 7, 2013)</small>
|
|
83
|
+
|
|
84
|
+
* Fix usage of deallocated memory when manipulating locale information.
|
|
85
|
+
* Special thanks to Dirkjan Bussink (@dbussink) for identifying this bug and providing the initial fix.
|
|
86
|
+
* Fix outdated links. Notably the API reference.
|
|
87
|
+
* Setup continuous integration.
|
|
88
|
+
|
|
89
|
+
## Version 2.0.7.2 <small>(Apr 6, 2013)</small>
|
|
90
|
+
|
|
91
|
+
* Fix compile error on Windows.
|
|
92
|
+
* Disallow install on Ruby 1.9.2, due to known bugs in Ruby.
|
|
93
|
+
* Please upgrade to Ruby 1.9.3 or later.
|
|
94
|
+
|
|
95
|
+
## Version 2.0.7.1 <small>(Feb 26, 2013)</small>
|
|
96
|
+
|
|
97
|
+
* Discount upgraded from 2.0.7 (non-final) -> 2.0.7
|
|
98
|
+
* Fix encoding of Unicode characters in URLs.
|
|
99
|
+
|
|
100
|
+
## Version 2.0.7 <small>(Jan 29, 2013)</small>
|
|
101
|
+
|
|
102
|
+
### New Features
|
|
103
|
+
|
|
104
|
+
* Discount upgraded from 1.6.8 -> 2.0.7 (non-final)
|
|
105
|
+
* Footnotes - from *PHP Markdown Extra*
|
|
106
|
+
* Superscript tweaks
|
|
107
|
+
* Be more picky about what comes before a ^ if we’re superscripting.
|
|
108
|
+
* Modify superscript grabbing so that it grabs parenthetical and alphanumeric blocks.
|
|
109
|
+
* Other bug fixes
|
|
110
|
+
* Table-of-contents generation will no longer crash for header items containing links.
|
|
111
|
+
* Adjacent new-style [link]s are no longer incorrectly combined.
|
|
112
|
+
|
|
113
|
+
### Known Issues
|
|
114
|
+
|
|
115
|
+
* Fails to build with MinGW or MinGW-64.
|
|
116
|
+
* Regression: Tags containing dashes and underscores are not escaped correctly.
|
|
117
|
+
* This will be fixed in RDiscount 2.1.5
|
|
118
|
+
|
|
119
|
+
## Version 1.6.8 <small>(Jan 25, 2011)</small>
|
|
120
|
+
|
|
121
|
+
* Discount upgraded from 1.6.5 -> 1.6.8
|
|
122
|
+
* Fix escaping of tags containing dashes and underscores.
|
|
123
|
+
|
|
124
|
+
## Earlier Releases
|
|
125
|
+
|
|
126
|
+
* Inspect the Git history.
|
data/Rakefile
CHANGED
|
@@ -138,7 +138,7 @@ task :gather => 'discount/markdown.h' do |t|
|
|
|
138
138
|
]
|
|
139
139
|
|
|
140
140
|
# Ensure configure.sh was run
|
|
141
|
-
if not File.
|
|
141
|
+
if not File.exist? 'discount/mkdio.h'
|
|
142
142
|
abort "discount/mkdio.h not found. Did you run ./configure.sh in the discount directory?"
|
|
143
143
|
end
|
|
144
144
|
|
|
@@ -171,6 +171,9 @@ task :gather => 'discount/markdown.h' do |t|
|
|
|
171
171
|
|
|
172
172
|
# Copy man page
|
|
173
173
|
cp 'discount/markdown.7', 'man/'
|
|
174
|
+
|
|
175
|
+
# Apply patches
|
|
176
|
+
system('cat ext.diff | patch -p1 -d ext')
|
|
174
177
|
end
|
|
175
178
|
|
|
176
179
|
file 'discount/markdown.h' do |t|
|
|
@@ -222,7 +225,11 @@ file 'rdiscount.gemspec' => FileList['Rakefile','lib/rdiscount.rb'] do |f|
|
|
|
222
225
|
files = `git ls-files`.
|
|
223
226
|
split("\n").
|
|
224
227
|
sort.
|
|
225
|
-
reject{
|
|
228
|
+
reject{|file|
|
|
229
|
+
file =~ /^\./ ||
|
|
230
|
+
file =~ /^test\/MarkdownTest/ ||
|
|
231
|
+
file =~ /^CLAUDE\.md|ext\.diff$/
|
|
232
|
+
}.
|
|
226
233
|
map{ |file| " #{file}" }.
|
|
227
234
|
join("\n")
|
|
228
235
|
# piece file back together and write...
|
data/ext/generate.c
CHANGED
|
@@ -180,13 +180,18 @@ Qprintf(MMIOT *f, char *fmt, ...)
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
|
|
183
|
+
static int Qchar_mkd_sta_function_t(const int n, const void* iot) {
|
|
184
|
+
Qchar(n, iot);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
183
188
|
/* Qanchor() prints out a suitable-for-id-tag version of a string
|
|
184
189
|
*/
|
|
185
190
|
static void
|
|
186
191
|
Qanchor(struct line *p, MMIOT *f)
|
|
187
192
|
{
|
|
188
193
|
mkd_string_to_anchor(T(p->text), S(p->text),
|
|
189
|
-
|
|
194
|
+
Qchar_mkd_sta_function_t, f, 1, f);
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
|
data/ext/gethopt.c
CHANGED
data/ext/rdiscount.c
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#include <stdio.h>
|
|
2
|
+
#include <limits.h>
|
|
2
3
|
#include <locale.h>
|
|
3
4
|
#include "ruby.h"
|
|
4
5
|
#include "mkdio.h"
|
|
@@ -43,6 +44,18 @@ static AccessorFlagPair ACCESSOR_2_FLAG[] = {
|
|
|
43
44
|
|
|
44
45
|
static VALUE rb_cRDiscount;
|
|
45
46
|
|
|
47
|
+
static int
|
|
48
|
+
rb_rdiscount__text_len(VALUE text)
|
|
49
|
+
{
|
|
50
|
+
long text_len = RSTRING_LEN(text);
|
|
51
|
+
|
|
52
|
+
if (text_len > INT_MAX) {
|
|
53
|
+
rb_raise(rb_eArgError, "markdown input too large");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (int)text_len;
|
|
57
|
+
}
|
|
58
|
+
|
|
46
59
|
int rb_rdiscount__get_flags(VALUE ruby_obj)
|
|
47
60
|
{
|
|
48
61
|
AccessorFlagPair *entry;
|
|
@@ -78,8 +91,10 @@ rb_rdiscount_to_html(int argc, VALUE *argv, VALUE self)
|
|
|
78
91
|
int szres;
|
|
79
92
|
VALUE encoding;
|
|
80
93
|
VALUE text = rb_funcall(self, rb_intern("text"), 0);
|
|
81
|
-
VALUE buf = rb_str_buf_new(1024);
|
|
82
94
|
Check_Type(text, T_STRING);
|
|
95
|
+
int text_len = rb_rdiscount__text_len(text); // may rb_raise
|
|
96
|
+
|
|
97
|
+
VALUE buf = rb_str_buf_new(1024);
|
|
83
98
|
|
|
84
99
|
int flags = rb_rdiscount__get_flags(self);
|
|
85
100
|
|
|
@@ -94,7 +109,7 @@ rb_rdiscount_to_html(int argc, VALUE *argv, VALUE self)
|
|
|
94
109
|
char *old_locale = strdup(setlocale(LC_CTYPE, NULL));
|
|
95
110
|
setlocale(LC_CTYPE, "C"); /* ASCII (and passthru characters > 127) */
|
|
96
111
|
|
|
97
|
-
MMIOT *doc = mkd_string(RSTRING_PTR(text),
|
|
112
|
+
MMIOT *doc = mkd_string(RSTRING_PTR(text), text_len, flags);
|
|
98
113
|
|
|
99
114
|
if ( mkd_compile(doc, flags) ) {
|
|
100
115
|
szres = mkd_document(doc, &res);
|
|
@@ -129,11 +144,12 @@ rb_rdiscount_toc_content(int argc, VALUE *argv, VALUE self)
|
|
|
129
144
|
/* grab char pointer to markdown input text */
|
|
130
145
|
VALUE text = rb_funcall(self, rb_intern("text"), 0);
|
|
131
146
|
Check_Type(text, T_STRING);
|
|
147
|
+
int text_len = rb_rdiscount__text_len(text); // may rb_raise
|
|
132
148
|
|
|
133
149
|
/* allocate a ruby string buffer and wrap it in a stream */
|
|
134
150
|
VALUE buf = rb_str_buf_new(4096);
|
|
135
151
|
|
|
136
|
-
MMIOT *doc = mkd_string(RSTRING_PTR(text),
|
|
152
|
+
MMIOT *doc = mkd_string(RSTRING_PTR(text), text_len, flags);
|
|
137
153
|
|
|
138
154
|
if ( mkd_compile(doc, flags) ) {
|
|
139
155
|
szres = mkd_toc(doc, &res);
|
data/ext/toc.c
CHANGED
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
#include "markdown.h"
|
|
16
16
|
#include "amalloc.h"
|
|
17
17
|
|
|
18
|
+
static int Csputc_mkd_sta_function_t(const int n, const void* iot) {
|
|
19
|
+
Csputc(n, iot);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
18
23
|
/* write an header index
|
|
19
24
|
*/
|
|
20
25
|
int
|
|
@@ -64,7 +69,7 @@ mkd_toc(Document *p, char **doc)
|
|
|
64
69
|
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
|
|
65
70
|
mkd_string_to_anchor(T(srcp->text->text),
|
|
66
71
|
S(srcp->text->text),
|
|
67
|
-
|
|
72
|
+
Csputc_mkd_sta_function_t,
|
|
68
73
|
&res,1,p->ctx);
|
|
69
74
|
Csprintf(&res, "\">");
|
|
70
75
|
Csreparse(&res, T(srcp->text->text),
|
data/lib/rdiscount.rb
CHANGED
data/rdiscount.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'rdiscount'
|
|
3
|
-
s.version = '2.2.7.
|
|
3
|
+
s.version = '2.2.7.4'
|
|
4
4
|
s.summary = "Fast Implementation of Gruber's Markdown in C"
|
|
5
5
|
s.email = 'david@dafoster.net'
|
|
6
6
|
s.homepage = 'http://dafoster.net/projects/rdiscount/'
|
|
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
# = MANIFEST =
|
|
10
10
|
s.files = %w[
|
|
11
11
|
BUILDING
|
|
12
|
+
CHANGELOG.md
|
|
12
13
|
COPYING
|
|
13
14
|
README.markdown
|
|
14
15
|
Rakefile
|
|
@@ -44,7 +45,6 @@ Gem::Specification.new do |s|
|
|
|
44
45
|
ext/pgm_options.h
|
|
45
46
|
ext/rdiscount.c
|
|
46
47
|
ext/resource.c
|
|
47
|
-
ext/ruby-config.h
|
|
48
48
|
ext/setup.c
|
|
49
49
|
ext/tags.c
|
|
50
50
|
ext/tags.h
|
data/test/rdiscount_test.rb
CHANGED
|
@@ -21,6 +21,25 @@ class RDiscountTest < Test::Unit::TestCase
|
|
|
21
21
|
RDiscount.new(text).to_html
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def test_that_oversized_input_raises_argument_error
|
|
25
|
+
# mkd_string() takes an int length, so inputs > INT_MAX (2 147 483 647 bytes)
|
|
26
|
+
# must be rejected before reaching C to avoid integer truncation / overflow.
|
|
27
|
+
int_max = 2_147_483_647 # INT_MAX in C
|
|
28
|
+
begin
|
|
29
|
+
oversized_text = 'a' * (int_max + 1)
|
|
30
|
+
# ArgumentError on TruffleRuby; RangeError on Windows
|
|
31
|
+
rescue NoMemoryError, ArgumentError, RangeError
|
|
32
|
+
# `omit` is Test::Unit's native skip; `skip` is Minitest's. Support both.
|
|
33
|
+
respond_to?(:omit, true) ?
|
|
34
|
+
omit("Insufficient memory to create oversized input for this test") :
|
|
35
|
+
skip("Insufficient memory to create oversized input for this test")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
assert_raise(ArgumentError) do
|
|
39
|
+
RDiscount.new(oversized_text).to_html
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
24
43
|
def test_that_smart_converts_double_quotes_to_curly_quotes
|
|
25
44
|
rd = RDiscount.new(%("Quoted text"), :smart)
|
|
26
45
|
assert_equal %(<p>“Quoted text”</p>\n), rd.to_html
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rdiscount
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.7.
|
|
4
|
+
version: 2.2.7.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Tomayko
|
|
@@ -9,12 +9,10 @@ authors:
|
|
|
9
9
|
- Andrew White
|
|
10
10
|
- David Foster
|
|
11
11
|
- l33tname
|
|
12
|
-
autorequire:
|
|
13
12
|
bindir: bin
|
|
14
13
|
cert_chain: []
|
|
15
|
-
date:
|
|
14
|
+
date: 2026-04-02 00:00:00.000000000 Z
|
|
16
15
|
dependencies: []
|
|
17
|
-
description:
|
|
18
16
|
email: david@dafoster.net
|
|
19
17
|
executables:
|
|
20
18
|
- rdiscount
|
|
@@ -24,6 +22,7 @@ extra_rdoc_files:
|
|
|
24
22
|
- COPYING
|
|
25
23
|
files:
|
|
26
24
|
- BUILDING
|
|
25
|
+
- CHANGELOG.md
|
|
27
26
|
- COPYING
|
|
28
27
|
- README.markdown
|
|
29
28
|
- Rakefile
|
|
@@ -58,7 +57,6 @@ files:
|
|
|
58
57
|
- ext/pgm_options.h
|
|
59
58
|
- ext/rdiscount.c
|
|
60
59
|
- ext/resource.c
|
|
61
|
-
- ext/ruby-config.h
|
|
62
60
|
- ext/setup.c
|
|
63
61
|
- ext/tags.c
|
|
64
62
|
- ext/tags.h
|
|
@@ -80,7 +78,6 @@ homepage: http://dafoster.net/projects/rdiscount/
|
|
|
80
78
|
licenses:
|
|
81
79
|
- BSD-3-Clause
|
|
82
80
|
metadata: {}
|
|
83
|
-
post_install_message:
|
|
84
81
|
rdoc_options: []
|
|
85
82
|
require_paths:
|
|
86
83
|
- lib
|
|
@@ -95,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
95
92
|
- !ruby/object:Gem::Version
|
|
96
93
|
version: '0'
|
|
97
94
|
requirements: []
|
|
98
|
-
rubygems_version: 3.2
|
|
99
|
-
signing_key:
|
|
95
|
+
rubygems_version: 3.6.2
|
|
100
96
|
specification_version: 4
|
|
101
97
|
summary: Fast Implementation of Gruber's Markdown in C
|
|
102
98
|
test_files:
|
data/ext/ruby-config.h
DELETED