Browse Source

Docs update

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
cb3b762958
  1. 48
      README.md
  2. 8
      demo/sample.js
  3. 20
      lib/configs/commonmark.js
  4. 12
      lib/configs/default.js
  5. 12
      lib/configs/full.js

48
README.md

@ -63,7 +63,13 @@ var md = new Remarkable({
breaks: false, // Convert '\n' in paragraphs into <br> breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks langPrefix: 'language-', // CSS language prefix for fenced blocks
linkify: false, // Autoconvert URL-like text to links linkify: false, // Autoconvert URL-like text to links
typographer: false, // Enable smartypants and other sweet transforms
// Enable some language-neutral replacement + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Set doubles to '«»' for Russian, '„“' for German.
quotes: '“”‘’',
// Highlighter function. Should return escaped HTML, // Highlighter function. Should return escaped HTML,
// or '' if the source string is not changed // or '' if the source string is not changed
@ -195,21 +201,27 @@ provides coverage for the most common and universal use cases:
```js ```js
var Remarkable = require('remarkable'); var Remarkable = require('remarkable');
var md = new Remarkable({ typographer: true }); var md = new Remarkable({
typographer: true,
quotes: '“”‘’'
});
// Actual default values // Disable rules at all:
md.typographer.set({ md.core.ruler.disable([ 'replacements', 'smartquotes' ]);
singleQuotes: '‘’', // set empty to disable
doubleQuotes: '“”', // set '«»' for Russian, '„“' for German, empty to disable // Actual default replacements:
copyright: true, // (c) (C) → © //
trademark: true, // (tm) (TM) → ™ // '' → ‘’
registered: true, // (r) (R) → ® // "" → “”. Set '«»' for Russian, '„“' for German, empty to disable
plusminus: true, // +- → ± // (c) (C) → ©
paragraph: true, // (p) (P) -> § // (tm) (TM) → ™
ellipsis: true, // ... → … (also ?.... → ?.., !.... → !..) // (r) (R) → ®
dupes: true, // ???????? → ???, !!!!! → !!!, `,,``,` // +- → ±
dashes: true // -- → &ndash;, --- → &mdash; // (p) (P) -> §
}) // ... → … (also ?.... → ?.., !.... → !..)
// ???????? → ???, !!!!! → !!!, `,,``,`
// -- → &ndash;, --- → &mdash;
//
``` ```
Of course, you can also add your own rules or replace the defaults with something Of course, you can also add your own rules or replace the defaults with something
@ -250,14 +262,12 @@ reconfigure anyone as you wish. Render also can be modified and extended. See
source code to understand details. Pay attention to these properties: source code to understand details. Pay attention to these properties:
```js ```js
Remarkable.core
Remarkable.core.ruler
Remarkable.block Remarkable.block
Remarkable.block.ruler Remarkable.block.ruler
Remarkable.inline Remarkable.inline
Remarkable.inline.ruler Remarkable.inline.ruler
Remarkable.typographer
Remarkable.typographer.ruler
Remarkable.linkifier
Remarkable.linkifier.ruler
Remarkable.renderer Remarkable.renderer
Remarkable.renderer.rules Remarkable.renderer.rules
``` ```

8
demo/sample.js

@ -7,7 +7,13 @@ var md = new Remarkable('full', {
breaks: false, // Convert '\n' in paragraphs into <br> breaks: false, // Convert '\n' in paragraphs into <br>
langPrefix: 'language-', // CSS language prefix for fenced blocks langPrefix: 'language-', // CSS language prefix for fenced blocks
linkify: true, // autoconvert URL-like texts to links linkify: true, // autoconvert URL-like texts to links
typographer: true, // Enable smartypants and other sweet transforms
// Enable some language-neutral replacements + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Set doubles to '«»' for Russian, '„“' for German.
quotes: '“”‘’',
// Highlighter function. Should return escaped HTML, // Highlighter function. Should return escaped HTML,
// or '' if input not changed // or '' if input not changed

20
lib/configs/commonmark.js

@ -11,17 +11,7 @@ module.exports = {
langPrefix: 'language-', // CSS language prefix for fenced blocks langPrefix: 'language-', // CSS language prefix for fenced blocks
linkify: false, // autoconvert URL-like texts to links linkify: false, // autoconvert URL-like texts to links
// Enable some language-neutral replacement + quotes beautification // Enable some language-neutral replacements + quotes beautification
//
// (c) (C) → ©
// (tm) (TM) → ™
// (r) (R) → ®
// +- → ±
// (p) (P) → §
// ... → …
// ???????? → ???, !!!!! → !!!, `,,` → `,`
// -- → —
//
typographer: false, typographer: false,
// Double + single quotes replacement pairs, when typographer enabled, // Double + single quotes replacement pairs, when typographer enabled,
@ -37,7 +27,13 @@ module.exports = {
components: { components: {
core: {}, core: {
rules: [
'block',
'inline',
'references'
]
},
block: { block: {
rules: [ rules: [

12
lib/configs/default.js

@ -11,17 +11,7 @@ module.exports = {
langPrefix: 'language-', // CSS language prefix for fenced blocks langPrefix: 'language-', // CSS language prefix for fenced blocks
linkify: false, // autoconvert URL-like texts to links linkify: false, // autoconvert URL-like texts to links
// Enable some language-neutral replacement + quotes beautification // Enable some language-neutral replacements + quotes beautification
//
// (c) (C) → ©
// (tm) (TM) → ™
// (r) (R) → ®
// +- → ±
// (p) (P) → §
// ... → …
// ???????? → ???, !!!!! → !!!, `,,` → `,`
// -- → —
//
typographer: false, typographer: false,
// Double + single quotes replacement pairs, when typographer enabled, // Double + single quotes replacement pairs, when typographer enabled,

12
lib/configs/full.js

@ -11,17 +11,7 @@ module.exports = {
langPrefix: 'language-', // CSS language prefix for fenced blocks langPrefix: 'language-', // CSS language prefix for fenced blocks
linkify: false, // autoconvert URL-like texts to links linkify: false, // autoconvert URL-like texts to links
// Enable some language-neutral replacement + quotes beautification // Enable some language-neutral replacements + quotes beautification
//
// (c) (C) → ©
// (tm) (TM) → ™
// (r) (R) → ®
// +- → ±
// (p) (P) → §
// ... → …
// ???????? → ???, !!!!! → !!!, `,,` → `,`
// -- → —
//
typographer: false, typographer: false,
// Double + single quotes replacement pairs, when typographer enabled, // Double + single quotes replacement pairs, when typographer enabled,

Loading…
Cancel
Save