有没有好的 Markdown Javascript 库或控件?
我想建立一个网站,用户可以在其中输入文本并以 Markdown 格式对其进行格式化。 我想要 Javascript 解决方案的原因是因为我想显示实时预览,就像在 StackOverflow 上一样。
然而,我的网站不针对开发人员,因此编辑器控件将是理想的选择。
我在 StackOverflow 上了解到,正在使用 WMD 编辑器。
在 Google 上快速搜索还可以找到 Showdown 库,我认为 WMD 实际上正在使用它。
还有其他选择吗? WMD/Showdown 已经是很棒的工具了吗? 对于不同的选择,您有什么经验?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我们对大规模杀伤性武器非常满意。 然而,其中存在一些棘手的错误。 没什么大不了的,但如果约翰·弗雷泽(作者)将代码开源,那么我会喜欢,这样我们就可以修复其中的一些问题。 他答应这样做,但现实生活中的其他项目却阻碍了他。
我每周都会跟进约翰。 一旦 WMD 源最终可用,我将在博客上发布。一年多以来一直无法联系约翰·弗雷泽。我们开源了 JavaScript Markdown 库
http://code.google.com/p/pagedown/< /a>
和服务器端 C# Markdown 库
http://code.google.com/p/markdownsharp /
We've been pretty happy with WMD. There are a few niggling bugs in it, however. Nothing major, but I would love if John Fraser (the author) made the code open source so we can fix some of them. He's promised to do so but other real life projects are getting in the way.
I do follow up with John every week. I'll post on the blog once the WMD source is finally available.Haven't been able to contact John Fraser in over a year now.We have open sourced both the JavaScript Markdown library
http://code.google.com/p/pagedown/
and the server-side C# Markdown library
http://code.google.com/p/markdownsharp/
如果您不反对使用 Ajax 生成实时预览,那么另一个选择是 markItUp! 。 标记它! 是一个通用的标记编辑器,并且非常灵活。 它确实提供了
创建标记编辑器的简单方法,但与 WMD 不同,它不提供自己的实时预览。
我将 markItUp! 以及一个简单的 JSP(使用 MarkdownJ)用于我的一个开源项目项目(用于 Markdown 插件 .apache.org/" rel="nofollow noreferrer">滚轮)。 如果您使用其他服务器端技术,请根据需要替换该简单的 JSP。
实际上,我在遇到 WMD 之前就开始使用它了。 我同意,WMD 很棒,但刚刚开源,在现阶段更难以定制其行为。
If you're not averse to using Ajax to generate the live preview, then another option is markItUp!. markItUp! is a universal markup-editor, and very flexible. It does provide
an easy way of creating a markup editor, but unlike WMD, it doesn't provide its own live preview.
I used markItUp!, along with a simple JSP (using MarkdownJ) for one of my open-source projects (a Markdown plugin for Roller). If you're using another server-side technology, replace that simple JSP as appropriate.
I actually starting using this before I came across WMD. I'd agree, WMD is great, but has only just been open-sourced and is, at this stage, more difficult to customize the behavior of.
我推荐 marked,它轻量、高效、易于使用,并且还支持 GitHub Flavored Markdown (GFM)。 它可以在服务器(nodejs)或客户端(浏览器)端使用。
I would recommend marked, which is lightweight, efficient, easy to use and supports GitHub Flavored Markdown (GFM) as well. It can be used in either server(nodejs) or client(browser) sides.
据我所知,确实没有任何其他基于浏览器的 Markdown 编辑器,至少没有像 WMD 编辑器那样广泛。
Showdown 是 JS 中的 Markdown 转换器,它构成了 WMD HTML 预览的基础。 它们都是由 http://attacklab.net/ 制作的。
据我所知,还没有对两者有任何大的抱怨(至少在 Markdown 邮件列表上没有)。 所以就去做吧。
As far as I know there really isn't any other browser-based editor for Markdown, at least none as extensive as the WMD editor.
Showdown is a Markdown converter in JS, which forms the basis for the HTML preview of WMD. They're both made by http://attacklab.net/.
And as far as I know there haven't been any big complaints about both (at least not on the Markdown mailing list). So go for it.
有一个名为 Showdown,目前托管在此处: https://github.com/coreyti/showdown
还有 https://github.com/evilstreak/markdown-js :)
There is one named Showdown and it is currently hosted here: https://github.com/coreyti/showdown
And there is https://github.com/evilstreak/markdown-js :)
最近发布的 Strapdown.js“使创建优雅的 Markdown 文档变得异常简单。无需服务器端编译。 ”
Strapdown.js, which was recently released, "makes it embarrassingly simple to create elegant Markdown documents. No server-side compilation required."
我还没有测试过这个,但这里有另一个选择:
Markdown wysiwyg
I've not tested this, but here is another option:
Markdown wysiwyg
这个问题现在更加古老,但也更加相关,因为提到的大部分代码已经过时了好几年。
然而,我确实发现了一些似乎仍然是最新的:
Jquery-Markedit - 这是从wmd-edit 很久以前就被重构为使用 jQuery。 乍一看似乎不错。
EpicEditor - 仍然得到维护,具有灵活的解析器,并且如下所示,作者高度评价响应式(见下文)。 IT 似乎也有很好的文档。 遗憾的是不能使用 IE9。
MarkdownDeep 是第三个选项,目前仍然有效。 这个有趣的一点是对 Markdown Extra 的支持。 对JQuery有依赖(实际上你也可以不使用JQuery来实现)。 基于 .NET 版本,因此文档比 JS 版本更符合该版本。 这也适用于 IE9。 它非常容易使用(使用 JQuery)& 很简单。 但据我所知,这方面没有发生重大进展。
js-markdown-extra 是 PHP 库的一个相当准确的端口,仍在维护中。 当然它支持 Markdown Extra。
The question is even more ancient now but also even more relevant since much of the mentioned code is several years out of date.
However, I did find a few that still seems current:
Jquery-Markedit - This was forked from wmd-edit quite some time ago and refactored to use jQuery. Seems good at first sight.
EpicEditor - is also still maintained, has a flexible parser and, as you can see below, the author is highly responsive (see below). IT seems to have good documentation as well. Sadly not working with IE9.
MarkdownDeep is a third option that is still current. The interesting point with this one is support for Markdown Extra. Has a dependency on JQuery (actually you can also implement without JQuery). Based on the .NET version so documentation is more aligned to that than the JS version. This also works with IE9. It is very easy to use (with JQuery) & very simple. No significant development happening with this though as far as I can see.
js-markdown-extra is a fairly accurate port of the PHP library and is still under maintenance. It supports Markdown Extra of course.
这个问题很古老,但希望这可以帮助某人。 我最近刚刚发布了我自己的 Javascript Markdown 编辑器的工作版本,uedit。 您可以在此处找到源代码。 它适用于大多数浏览器(包括 IE6+),并且不依赖于任何外部 JS 库。
The question is ancient but hopefully this might help someone. I have just recently published a working version of my own Javascript markdown editor, uedit. You can find the source code here. It works on most browsers (including IE6+) and doesn't depend on any external JS libraries.
在尝试使用几个插件来解决我自己提供 MarkDown 所见即所得的需求之后,我最终实现了自己的一个:
也许不像这里评论的所有解决方案那么强大,但我认为没有一个是简单且易于集成和定制的。
After trying with several plugins to solve my own needs of offering a MarkDown seudo-WYSIWYG I ended implementing my own one:
Maybe is not as powerful as all the solutions commented here but I think that none is as simple and easy to integrate and customize.