All threads / SimpleMDE & RedCarpet

Ask A Question

Notifications

You’re not receiving notifications from this thread.

SimpleMDE & RedCarpet

Matt Taylor asked in Gems / Libraries

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

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,344+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.