New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raising errors in callbacks crashes a Markdown instance #318

Open
adamflorin opened this Issue Oct 18, 2013 · 2 comments

Comments

Projects
None yet
3 participants
@adamflorin

adamflorin commented Oct 18, 2013

Please see reproducible case:

https://gist.github.com/adamflorin/7045640

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:

Assertion failed: (md->work_bufs[BUFFER_BLOCK].size == 0), function sd_markdown_render, file markdown.c, line 2544.
Abort trap: 6

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?

lynxnathan added a commit to lynxnathan/grape-swagger that referenced this issue Sep 30, 2014

@KCErb

This comment has been minimized.

Show comment
Hide comment
@KCErb

KCErb Apr 28, 2015

FWIW

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).

KCErb commented Apr 28, 2015

FWIW

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).

@aselder

This comment has been minimized.

Show comment
Hide comment
@aselder

aselder May 18, 2016

We're seeing this also: RedCarpet 3.3.4, Ruby 2.2.5

aselder commented May 18, 2016

We're seeing this also: RedCarpet 3.3.4, Ruby 2.2.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment