Browse Source

Readme update after review

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
8a5fcf3693
  1. 84
      README.md

84
README.md

@ -23,9 +23,9 @@ __Table of content__
- [.set({ keys: values })](#set-keys-values-)
- [.use(plugin, options)](#useplugin-options)
- [Syntax highlighting](#syntax-highlighting)
- [Typographer](#typographer)
- [Syntax extensions](#syntax-extensions)
- [Manage rules](#manage-rules)
- [Typographer](#typographer)
- [Benchmark](#benchmark)
- [Authors](#authors)
- [References / Thanks](#references--thanks)
@ -73,7 +73,7 @@ Usually, you will define everything via constructor.
#### constructor(preset, options)
##### preset (String) - `"full"`|`"commonmark"`, optional.
__preset__ (String) - `"full"`|`"commonmark"`, optional.
`markdown-it` offers some presets as a convenience to quickly enable/disable
active syntax rules and options for common use cases.
@ -100,7 +100,7 @@ var md = require('markdown-it')('full', {
});
```
##### options
__options__
```js
// Actual default values
@ -181,6 +181,39 @@ var md = require('markdown-it')({
```
### Typographer
Although full-weight typographical replacements are language specific, `markdown-it`
provides coverage for the most common and universal use cases:
```js
var md = require('markdown-it')({
typographer: true,
quotes: '“”‘’'
});
// Disable rules at all:
md.disable([ 'replacements', 'smartquotes' ]);
// Actual default replacements:
//
// '' → ‘’
// "" → “”. Set '«»' for Russian, '„“' for German, empty to disable
// (c) (C) → ©
// (tm) (TM) → ™
// (r) (R) → ®
// +- → ±
// (p) (P) -> §
// ... → … (also ?.... → ?.., !.... → !..)
// ???????? → ???, !!!!! → !!!, `,,``,`
// -- → –, --- → —
//
```
Of course, you can also add your own rules or replace the defaults with something
more advanced or specific to your language.
### Syntax extensions
Enabled by default:
@ -206,10 +239,10 @@ old-style rules via external plugins if you prefer.
### Manage rules
```js
var md = require('markdown-it')();
// Activate/deactivate rules
md.enable([ 'ins', 'mark' ]).disable([ 'table' ]);
var md = require('markdown-it')();
.enable([ 'ins', 'mark' ])
.disable([ 'table' ]);
// Enable everything
md = require('markdown-it')('full', {
@ -220,7 +253,7 @@ md = require('markdown-it')('full', {
// Manually enable rules, disabled by default:
var md = require('markdown-it')();
md.enable([
.enable([
/* core */
'abbr',
/* block */
@ -236,39 +269,6 @@ md.enable([
```
### Typographer
Although full-weight typographical replacements are language specific, `markdown-it`
provides coverage for the most common and universal use cases:
```js
var md = require('markdown-it')({
typographer: true,
quotes: '“”‘’'
});
// Disable rules at all:
md.core.ruler.disable([ 'replacements', 'smartquotes' ]);
// Actual default replacements:
//
// '' → ‘’
// "" → “”. Set '«»' for Russian, '„“' for German, empty to disable
// (c) (C) → ©
// (tm) (TM) → ™
// (r) (R) → ®
// +- → ±
// (p) (P) -> §
// ... → … (also ?.... → ?.., !.... → !..)
// ???????? → ???, !!!!! → !!!, `,,``,`
// -- → –, --- → —
//
```
Of course, you can also add your own rules or replace the defaults with something
more advanced or specific to your language.
## Benchmark
Here is result of CommonMark spec parse at Core i5 2.4 GHz (i5-4258U):
@ -303,9 +303,9 @@ during this project's development.
**Related Links:**
1. https://github.com/jgm/CommonMark - reference CommonMark implementations in C & JS,
- https://github.com/jgm/CommonMark - reference CommonMark implementations in C & JS,
also contains latest spec & online demo.
2. http://talk.commonmark.org - CommonMark forum, good place to collaborate
- http://talk.commonmark.org - CommonMark forum, good place to collaborate
developers' efforts.
## License

Loading…
Cancel
Save