Skip to main content

SimpleMDE & RedCarpet

Gems / Libraries • Asked by Matt Taylor

So i have set up my forum with simpleMDE and i'm using RedCarpet to parse the markdown. Everything works great except when it parses the markdown, it adds extra set of <p> tags before and after my post content. Anyone had experience with theses too and might have a clue why this is happening.

Here is the code snippet of the Renderer.

def markdown(content)
    @markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, {
      autolink: true,
      space_after_headers: true,
      fenced_code_blocks: true,
      underline: true,
      highlight: true,
      footnotes: true,
      tables: true
    })
    @markdown.render(content)
  end

Thanks


If I remember correct this is by design. Text "should" be wrapped by <p />'s.

Used it some time ago, so unsure if this behavior can be changed now.


Hey Jack. The problem is this. <p></p><p>content goes here</p><p></p> Notice the extra opening and closing p tags before and after the content p tags.


I have a similar problem. When I 'm on the edit action the content of the textarea I'm having the SimpleMDE is diplaying indented like you see on the screenshot

.


There was a issue closed long ago about that. You can find a potential solution here

https://github.com/vmg/redcarpet/issues/92


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.