Markdown to plain text in Ruby?

后端 未结 3 1794
盖世英雄少女心
盖世英雄少女心 2021-01-07 21:26

I\'m currently using BlueCloth to process Markdown in Ruby and show it as HTML, but in one location I need it as plain text (without some of the Markdown). Is there a way to

3条回答
  •  被撕碎了的回忆
    2021-01-07 21:54

    RedCarpet gem has a Redcarpet::Render::StripDown renderer which "turns Markdown into plaintext".

    Copy and modify it to suit your needs.

    Or use it like this:

    Redcarpet::Markdown.new(Redcarpet::Render::StripDown).render(markdown)
    

提交回复
热议问题