// Enable some language-neutral replacement + quotes beautification
// Enable some language-neutral replacement + quotes beautification
// For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
// For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs
typographer: false,
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// Double + single quotes replacement pairs, when typographer enabled,
@ -258,9 +258,9 @@ const md = markdownit({
You can find all rules in sources:
You can find all rules in sources:
- [`parser_core.js`](lib/parser_core.js)
- [`parser_core.mjs`](lib/parser_core.mjs)
- [`parser_block.js`](lib/parser_block.js)
- [`parser_block.mjs`](lib/parser_block.mjs)
- [`parser_inline.js`](lib/parser_inline.js)
- [`parser_inline.mjs`](lib/parser_inline.mjs)
## Benchmark
## Benchmark
@ -281,7 +281,7 @@ Sample: README.md (7774 bytes)
> marked x 1,587 ops/sec ±4.31% (93 runs sampled)
> marked x 1,587 ops/sec ±4.31% (93 runs sampled)
```
```
__Note.__ CommonMark version runs with [simplified link normalizers](https://github.com/markdown-it/markdown-it/blob/master/benchmark/implementations/current-commonmark/index.js)
__Note.__ CommonMark version runs with [simplified link normalizers](https://github.com/markdown-it/markdown-it/blob/master/benchmark/implementations/current-commonmark/index.mjs)
for more "honest" compare. Difference is ≈1.5×.
for more "honest" compare. Difference is ≈1.5×.
As you can see, `markdown-it` doesn't pay with speed for its flexibility.
As you can see, `markdown-it` doesn't pay with speed for its flexibility.
The right sequence is to split text to several tokens and add link tokens in between.
The right sequence is to split text to several tokens and add link tokens in between.
The result will be: `text` + `link_open` + `text` + `link_close` + `text`.
The result will be: `text` + `link_open` + `text` + `link_close` + `text`.
See implementations of [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js) and [emoji](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/replace.js) - those do text token splits.
See implementations of [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.mjs) and [emoji](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/replace.mjs) - those do text token splits.
__Note.__ Don't try to replace text with HTML markup! That's not secure.
__Note.__ Don't try to replace text with HTML markup! That's not secure.
#### Why my inline rule is not executed?
#### Why my inline rule is not executed?
The inline parser skips pieces of texts to optimize speed. It stops only on [a small set of chars](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_inline/text.js), which can be tokens. We did not made this list extensible for performance reasons too.
The inline parser skips pieces of texts to optimize speed. It stops only on [a small set of chars](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_inline/text.mjs), which can be tokens. We did not made this list extensible for performance reasons too.
If you are absolutely sure that something important is missing there - create a
If you are absolutely sure that something important is missing there - create a
ticket and we will consider adding it as a new charcode.
ticket and we will consider adding it as a new charcode.