Skip to content

Commit 92a7b3a

Browse files
committed
Fix a segfault with StripDown and the :quote option
Since the `StripDown` render extends from `Base`, every available callback should be defined to avoid segmentation faults since the C code assumes that it **doesn't** deal with a `Base` object. Fixes #639.
1 parent 7352162 commit 92a7b3a

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
* Fix a segfault rendering quotes using `StripDown` and the `:quote`
4+
option.
5+
6+
Fixes #639.
7+
38
* Fix `warning: instance variable @options not initialized` when
49
running under verbose mode (`-w`, `$VERBOSE = true`).
510

lib/redcarpet/render_strip.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class StripDown < Base
1313
:autolink, :codespan, :double_emphasis,
1414
:emphasis, :underline, :raw_html,
1515
:triple_emphasis, :strikethrough,
16-
:superscript, :highlight,
16+
:superscript, :highlight, :quote,
1717

1818
# footnotes
1919
:footnotes, :footnote_def, :footnote_ref,

test/stripdown_render_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ def test_highlight
5858

5959
assert_equal expected, output
6060
end
61+
62+
def test_with_quote_option_enabled
63+
markdown = %(A common idiom is "Hello world")
64+
expected = %(A common idiom is Hello world)
65+
output = render(markdown, with: [:quote])
66+
67+
assert_equal expected, output
68+
end
6169
end

0 commit comments

Comments
 (0)