使用 Java/Scala 将 Markdown 转换为 HTML

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19784525/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 20:11:01  来源:igfitidea点击:

Markdown to HTML with Java/Scala

javascalamarkdown

提问by Erich Schreiner

I am aware of following projects (mostly from http://www.w3.org/community/markdown/wiki/MarkdownImplementations):

我知道以下项目(主要来自http://www.w3.org/community/markdown/wiki/MarkdownImplementations):

implemented in Java:

用Java实现:

implemented in Scala:

在 Scala 中实现:

Q:What are the respective performance characteristics, pitfalls, quirks? Which ones support the Github extensions? Which one would you recommend for a Play! / Scala application?

问:各自的性能特点、缺陷和怪癖是什么?哪些支持 Github 扩展?你会推荐哪一个玩!/ Scala 应用程序?

采纳答案by adarshr

The fantastic microbenchmark toolcreated by MarkdownPapers' author compares the performance for the following implementations:

MarkdownPapers 的作者创建的出色的微基准测试工具比较了以下实现的性能:

  • MarkdownPapers
  • PegDown
  • Knockoff
  • MarkdownJ
  • TxtMark
  • 降价纸
  • 钉住
  • 仿冒品
  • 降价J
  • 文本标记

TxtMark far exceeds the performance of the other tools, as shown in the following graph:

TxtMark 的性能远远超过其他工具,如下图所示:

Performance comparisons of markdown implementations

Markdown 实现的性能比较

PegDown, which supports many GitHub extensions and others, is far more fully featured. Custom plugins or extensions are also possible.

PegDown 支持许多 GitHub 扩展和其他扩展,功能更加全面。自定义插件或扩展也是可能的。

My use case involved processing markdown from an administrative screen where performance was less impactful than a rich feature set, which meant PegDown won over TxtMark.

我的用例涉及从管理屏幕处理降价,其中性能的影响不如丰富的功能集,这意味着 PegDown 胜过 TxtMark。