Ruby/Redcarpet: strip markdown from text
Asked Answered
K

1

6

I'm writing a Ruby app and it currently uses redcarpet to render Markdown.

I need to strip Markdown markup from a text. Any easy way to do it?

Kampong answered 12/2, 2016 at 9:58 Comment(0)
C
11

Yes, it's possible with the Redcarpet::Render::StripDown Class -> https://rubydoc.info/gems/redcarpet/Redcarpet/Render/StripDown

It says "Turns Markdown into plaintext"

Carlyle answered 12/2, 2016 at 10:3 Comment(2)
Thanks! D'oh! Should have searched better.Kampong
I ran into an Uninitialized constant: Redcarpet::Render::StripDown error, but adding require 'redcarpet/render_strip' fixed it; see github.com/vmg/redcarpet/issues/138Shotton

© 2022 - 2024 — McMap. All rights reserved.