Browse Source

Readme update after review

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

112
README.md

@ -23,9 +23,9 @@ __Table of content__
- [.set({ keys: values })](#set-keys-values-) - [.set({ keys: values })](#set-keys-values-)
- [.use(plugin, options)](#useplugin-options) - [.use(plugin, options)](#useplugin-options)
- [Syntax highlighting](#syntax-highlighting) - [Syntax highlighting](#syntax-highlighting)
- [Typographer](#typographer)
- [Syntax extensions](#syntax-extensions) - [Syntax extensions](#syntax-extensions)
- [Manage rules](#manage-rules) - [Manage rules](#manage-rules)
- [Typographer](#typographer)
- [Benchmark](#benchmark) - [Benchmark](#benchmark)
- [Authors](#authors) - [Authors](#authors)
- [References / Thanks](#references--thanks) - [References / Thanks](#references--thanks)
@ -73,7 +73,7 @@ Usually, you will define everything via constructor.
#### constructor(preset, options) #### 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 `markdown-it` offers some presets as a convenience to quickly enable/disable
active syntax rules and options for common use cases. active syntax rules and options for common use cases.
@ -100,7 +100,7 @@ var md = require('markdown-it')('full', {
}); });
``` ```
##### options __options__
```js ```js
// Actual default values // 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 ### Syntax extensions
Enabled by default: Enabled by default:
@ -206,10 +239,10 @@ old-style rules via external plugins if you prefer.
### Manage rules ### Manage rules
```js ```js
var md = require('markdown-it')();
// Activate/deactivate rules // Activate/deactivate rules
md.enable([ 'ins', 'mark' ]).disable([ 'table' ]); var md = require('markdown-it')();
.enable([ 'ins', 'mark' ])
.disable([ 'table' ]);
// Enable everything // Enable everything
md = require('markdown-it')('full', { md = require('markdown-it')('full', {
@ -220,54 +253,21 @@ md = require('markdown-it')('full', {
// Manually enable rules, disabled by default: // Manually enable rules, disabled by default:
var md = require('markdown-it')(); var md = require('markdown-it')();
md.enable([ .enable([
/* core */ /* core */
'abbr', 'abbr',
/* block */ /* block */
'footnote', 'footnote',
'deflist', 'deflist',
/* inline */ /* inline */
'footnote_inline', 'footnote_inline',
'ins', 'ins',
'mark', 'mark',
'sub', 'sub',
'sup' 'sup'
]); ]);
```
### 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 ## Benchmark
@ -303,10 +303,10 @@ during this project's development.
**Related Links:** **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. 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. developers' efforts.
## License ## License

Loading…
Cancel
Save