Ruby/Redcarpet:从文本中删除markdown

sum*_*mek 3 ruby markdown redcarpet

我正在编写一个Ruby应用程序,它目前使用redcarpet渲染Markdown.

我需要从文本中删除Markdown标记.有什么简单的方法吗?

Cai*_*lou 6

是的,可以使用Redcarpet::Render::StripDownClass - > http://www.rubydoc.info/github/vmg/redcarpet/Redcarpet/Render/StripDown

它说"将Markdown变成明文"

  • 我遇到了一个 `Uninitialized constant: Redcarpet::Render::StripDown` 错误,但是添加 `require 'redcarpet/render_strip'` 修复了它;见 https://github.com/vmg/redcarpet/issues/138 (2认同)