markdown-it-directive
Advanced tools
Comparing version 1.0.0 to 1.0.1
10
index.js
@@ -276,2 +276,12 @@ 'use strict'; | ||
if (!silent) { | ||
// markdown-it uses escape rule to unescape content in `[text]`, | ||
// and use unescapeAll function to unescape content in `"title"`. | ||
// | ||
// Directive handler needs to use unescapeAll manually | ||
// since different plugins have different demands | ||
// (some treat the content as markdown and continue to parse it, | ||
// others treat the content as text so they need to unescape it). | ||
// | ||
// Markdown's design that paired `[]` doesn't need to be escaped | ||
// avoids "escape melaleuca" like `[\[\\[\\]\]]`. Clever design. | ||
handler(state, content, dests, attrs, contentStart, contentEnd, state.pos, pos); | ||
@@ -278,0 +288,0 @@ } |
{ | ||
"name": "markdown-it-directive", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Directive extension for markdown-it markdown parser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -57,3 +57,3 @@ # markdown-it-directive | ||
`handler` will receive the parsed link destinations (ie those in `()`) (ie `dests`), attributes (ie `attrs`), unescaped `content` and the position of each component of the directive, and needs to store processed things in the MarkdownIt Token stream. Full details can be found in [markdown-it-directive-webcomponents] (https://github.com/hilookas/markdown-it-directive-webcomponents). | ||
`handler` will receive the parsed link destinations (ie those in `()`) (ie `dests`), attributes (ie `attrs`), not unescaped `content` and the position of each component of the directive, and needs to store processed things in the MarkdownIt Token stream. Full details can be found in [markdown-it-directive-webcomponents] (https://github.com/hilookas/markdown-it-directive-webcomponents). | ||
@@ -60,0 +60,0 @@ ## Example |
@@ -55,3 +55,3 @@ # markdown-it-directive | ||
`handler` 需要接收已经解析过的 link destinations (即括号中的那些)(即 `dests`), attributes (即 `attrs`),未转义的 `content` 以及指令的各个组件的位置,并且将处理后的内容添加到 MarkdownIt Token 流中。具体处理过程可以参见 [markdown-it-directive-webcomponents](https://github.com/hilookas/markdown-it-directive-webcomponents) 代码。 | ||
`handler` 需要接收已经解析过的 link destinations (即括号中的那些)(即 `dests`), attributes (即 `attrs`),未反转义的 `content` 以及指令的各个组件的位置,并且将处理后的内容添加到 MarkdownIt Token 流中。具体处理过程可以参见 [markdown-it-directive-webcomponents](https://github.com/hilookas/markdown-it-directive-webcomponents) 代码。 | ||
@@ -58,0 +58,0 @@ ## 样例 |
38962
670