Skip to content

Commit

Permalink
Fix a segfault with StripDown and the :quote option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robin850 committed Mar 25, 2018
1 parent 7352162 commit 92a7b3a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

* Fix a segfault rendering quotes using `StripDown` and the `:quote`
option.

Fixes #639.

* Fix `warning: instance variable @options not initialized` when
running under verbose mode (`-w`, `$VERBOSE = true`).

Expand Down
2 changes: 1 addition & 1 deletion lib/redcarpet/render_strip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class StripDown < Base
:autolink, :codespan, :double_emphasis,
:emphasis, :underline, :raw_html,
:triple_emphasis, :strikethrough,
:superscript, :highlight,
:superscript, :highlight, :quote,

# footnotes
:footnotes, :footnote_def, :footnote_ref,
Expand Down
8 changes: 8 additions & 0 deletions test/stripdown_render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,12 @@ def test_highlight

assert_equal expected, output
end

def test_with_quote_option_enabled
markdown = %(A common idiom is "Hello world")
expected = %(A common idiom is Hello world)
output = render(markdown, with: [:quote])

assert_equal expected, output
end
end

0 comments on commit 92a7b3a

Please sign in to comment.