gpt4 book ai didi

ruby-on-rails - Rails 中类似 Smarty Pants 的功能

转载 作者:太空宇宙 更新时间:2023-11-03 18:02:20 26 4
gpt4 key购买 nike

Smarty Pants对我来说听起来是个很酷的主意:

SmartyPants 可以执行以下转换:

  • 将直引号( "和 ' )转换为“ curl ”引号 HTML 实体
  • 将反引号样式的引号(``like this'')转换为“ curl ”引号 HTML 实体
  • 破折号(“--”和“---”)组成 en- 和 em-dash 实体
  • 三个连续的点(“...”)组成一个省略号实体

将此类功能集成到我的 Rails 项目中的最佳方法是什么? (连字符 v. 破折号让我发疯!)。

(我正在征求用户对 markdown 的意见,因此理想的解决方案是一个也可以进行 Smarty Pants 转换的 markdown 处理器。)

最佳答案

http://tomayko.com/writings/ruby-markdown-libraries-real-cheap-for-you-two-for-price-of-one :

[there are] two solid Ruby extension libraries: one that wraps Jon MacFarleane’s peg-markdown and one that wraps David Loren Parsons’s Discount. Both are complete implementations of core Markdown plus SmartyPants in C.

关于ruby-on-rails - Rails 中类似 Smarty Pants 的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1408448/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com