学习笔记《Markdown》

从第一次在简书写 Markdown 格式的文章以来,就再也没有使用过所见即所得编辑器,算算也只有半年左右的时间,但是喜爱程度,真的是无以复加,刚好团队准备把 Markdown 引入到项目里面,所以专门学习了一下

Markdown 语法的创造者是 John Gruber,他在2004年发布了 Markdown 语法的第一版并维护到现在,有意思的话,他现在业余在做一个叫做 The Talk Show 的 podcast,可以在苹果的 podcast 里面订阅,Aaron Swartz 也参与了 Markdown 标准的制定,对,就是那个让人敬佩而又遗憾的 Aaron Swartz

维基百科上有详细的历史梗概介绍:
https://en.wikipedia.org/wiki/Markdown

Markdown 实际上没有正式的官方标准,John Gruber 本人在2004年发布了 Markdown 1.0.1 属于最起先的版本:
http://daringfireball.net/projects/markdown/
基本语法:
http://daringfireball.net/projects/markdown/syntax

后来人对 Markdown 做了不少的语法改进,包括:

  • CommonMark
  • Markdown Extra

Markdown 的标准化也在紧锣密鼓的制定中:

In March 2016 RFC 7763 and RFC 7764 were published. RFC 7763 introduced MIME type text/markdown with the original variant. RFC 7764 discusses and registered the variants MultiMarkdown, GitHub Flavored Markdown (GFM), Pandoc, CommonMark, and Markdown Extra among others

simplemde

最初选择使用了这个叫做 simplemde 的编辑器,这个编辑器是用的 marked 作为解析器:https://github.com/chjj/marked

└─┬ vue-simplemde@0.3.7
  └─┬ simplemde@1.11.2
    └── marked@0.3.6

SimpleMDE began as an improvement of lepture's Editor project, but has now taken on an identity of its own. It is bundled with CodeMirror and depends on Font Awesome.
CodeMirror is the backbone of the project and parses much of the Markdown syntax as it's being written. This allows us to add styles to the Markdown that's being written. Additionally, a toolbar and status bar have been added to the top and bottom, respectively. Previews are rendered by Marked using GFM.

markdown-it

目前选择的是 markdown-it,原因是 markdown-it 属于基于 CommonMark 这套相对比较主流的标准的,围绕其的生态在未来也许会有不错的稳定性:

From 2012, a group of people including Jeff Atwood launched what Atwood characterized as a standardization effort. A community website now aims to "document various tools and resources available to document authors and developers, as well as implementors of the various markdown implementations". In September 2014, Gruber objected to the usage of "Markdown" in the name of this effort and it was rebranded as a new dialect named CommonMark. CommonMark.org published several versions of a specification, reference implementation, and test suite, and "[plans] to announce a finalized 1.0 spec and test suite in 2017."
In 2017 GitHub released a formal specification of their GitHub Flavored Markdown (GFM) that is based on CommonMark. It follows the CommonMark specification exactly except for tables, strikethrough, autolinks and task lists, which the GitHub spec has added as extensions.

https://github.com/commonmark/CommonMark/wiki/List-of-CommonMark-Implementations

markdown-it 本身支持的插件也非常的多,目前有150多个:
https://www.npmjs.com/browse/keyword/markdown-it

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容