Join GitHub today
Raising errors in callbacks crashes a Markdown instance #318
Please see reproducible case:
If I use a Markdown instance repeatedly to render text, and raise an error within a custom formatting callback, eventually Redcarpet (or Sundown?) will crash, bringing down Ruby with it, with the error:
In my case, I can just instantiate a new Redcarpet instance each time I render, so this is not pressing for me. But perhaps of interest to you?
added a commit
Sep 30, 2014
I get the same error by essentially this:
Attach my renderer somewhere accessible:
NameSpace.text_renderer = Redcarpet::Markdown.new(TextRenderer, opts)
Spin up an instance, and inside that instance call it again:
text_renderer.render text ### Inside TextRenderer def block_code(file_path, content) # . . . NameSpace.text_renderer.render content # . . . end
I'll use @lynxnathan's suggestion of just making a new instance but thought I'd pass on another use case.
(In my case, I'm not using the fenced code block for code, I'm using it for a figure caption, and I want to be able to put bold text etc in the figure caption, thus I need to render inside as well).