markdown-it
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -19,2 +19,3 @@ { | ||
"demo", | ||
"docs", | ||
"lib", | ||
@@ -21,0 +22,0 @@ "node_modules", |
119
CHANGELOG.md
@@ -0,1 +1,11 @@ | ||
2.1.0 / 2014-12-21 | ||
------------------ | ||
- Separated method to enable rules by whitelist (enableOnly). | ||
- Changed second param of enable/disable ruler methods. | ||
- Shortcuts in main class for bulk enable/disable rules. | ||
- ASCII-friendly browserified files. | ||
- Separate package for spec tests. | ||
2.0.0 / 2014-12-20 | ||
@@ -7,110 +17,1 @@ ------------------ | ||
- Renamed presets folder (configs -> presets). | ||
1.5.0 / 2014-12-12 | ||
------------------ | ||
- Added Demo sync scroll, to show how lines mapping can be used. | ||
- Improved IE8 support. Now you need only es5-shim, without es5-sham. | ||
- Fixed errors on refs/attrs/footnoted with special names like `__proto__`. | ||
- Renamed Ruler() private properties, to show those should not be accessed | ||
directly. | ||
- Fixed Makefile OSX compatibility. | ||
1.4.2 / 2014-11-29 | ||
------------------ | ||
- Added footnotes support. | ||
- Added definitions lists support. | ||
- Added `fence_custom` renderer extension to easy override | ||
named fenced blocks (useful for diagrams and so on). | ||
- Exposed `./common/utils` to simplify custom renderers. | ||
1.4.1 / 2014-11-13 | ||
------------------ | ||
- Moved links decode/encode from renderer to parser. | ||
- Added missed validator call for scoped urls in links. | ||
- Handle exceptions in `decoreURI` (regression). | ||
1.4.0 / 2014-11-09 | ||
------------------ | ||
- Added `core` chain, to better organize code and improve pluggability. | ||
- Added `renderInline()` and `parseInline()` methods. | ||
- Added abbreviations support. | ||
- Fixed problem with tables, having single column. | ||
- Fixed rendered rules rewrite for inline tags. | ||
- Changed internal api (ruler, inline, block classes). | ||
- Removed typographer chain (rules moved to `core`). | ||
- Removed all typographer options. Quote chars defs moved to `options.quotes`. | ||
1.3.0 / 2014-10-29 | ||
------------------ | ||
- Fixed problem with minified & mangled browser version. | ||
- Changed ruler API. | ||
1.2.2 / 2014-10-29 | ||
------------------ | ||
- Fixed regression from 1.2.1 for data without tailing `\n`. | ||
- Fixed blockquote line ranges. | ||
- Added subscript/superscript support. | ||
- Updated CommonMark spec and updated implementation. | ||
- Other minor changes. | ||
1.2.1 / 2014-10-28 | ||
------------------ | ||
- Fixed speed degradation when linkifier enabled. | ||
- Added coverage reports. | ||
- Added debug view to demo (show internal representation) | ||
- Other minor optimizations and cleanup. | ||
1.2.0 / 2014-10-26 | ||
------------------ | ||
- Added `<ins>` rule. | ||
- Added `<mark>` rule. | ||
- Added presets support (default, commonmark, full). | ||
- Exposed `.configure()` method to load rules & options config with one command. | ||
- Moved html escaping to renderer. | ||
1.1.2 / 2014-10-23 | ||
------------------ | ||
- Fixed speed regression. | ||
- Use base64 encoding for permalinks (workaround for github). | ||
- Improved default link validator. | ||
- Updated cache storage logic for inline parser. | ||
1.1.1 / 2014-10-22 | ||
------------------ | ||
- Fixed `Ruler.after()` method. | ||
- Fixed linkification. | ||
- Simplified loose/tight rendering. | ||
- Refactored inline parser. No close coupled code in rules anymore. | ||
1.1.0 / 2014-10-20 | ||
------------------ | ||
- Code refactoring, bugfixes, API update. | ||
- Added source lines info to block nodes. | ||
1.0.0 / 2014-10-16 | ||
------------------ | ||
- First release. |
@@ -80,3 +80,3 @@ // Main perser class | ||
if (presets.components[name].rules) { | ||
self[name].ruler.enable(presets.components[name].rules, true); | ||
self[name].ruler.enableOnly(presets.components[name].rules); | ||
} | ||
@@ -88,2 +88,20 @@ }); | ||
// Sugar to enable rules by names in all chains at once | ||
// | ||
MarkdownIt.prototype.enable = function (list) { | ||
[ 'core', 'block', 'inline' ].forEach(function (chain) { | ||
this[chain].ruler.enable(list, true); | ||
}, this); | ||
}; | ||
// Sugar to disable rules by names in all chains at once | ||
// | ||
MarkdownIt.prototype.disable = function (list) { | ||
[ 'core', 'block', 'inline' ].forEach(function (chain) { | ||
this[chain].ruler.disable(list, true); | ||
}, this); | ||
}; | ||
// Sugar for curried plugins init: | ||
@@ -114,2 +132,3 @@ // | ||
// Main method that does all magic :) | ||
@@ -135,2 +154,3 @@ // | ||
// Render single string, without wrapping it to paragraphs | ||
@@ -137,0 +157,0 @@ // |
@@ -19,3 +19,3 @@ // Commonmark default options | ||
// and smartquotes on. Set doubles to '«»' for Russian, '„“' for German. | ||
quotes: '“”‘’', | ||
quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */, | ||
@@ -22,0 +22,0 @@ // Highlighter function. Should return escaped HTML, |
@@ -19,3 +19,3 @@ // markdown-it default options | ||
// and smartquotes on. Set doubles to '«»' for Russian, '„“' for German. | ||
quotes: '“”‘’', | ||
quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */, | ||
@@ -22,0 +22,0 @@ // Highlighter function. Should return escaped HTML, |
@@ -19,3 +19,3 @@ // markdown-it `full` options | ||
// and smartquotes on. Set doubles to '«»' for Russian, '„“' for German. | ||
quotes: '“”‘’', | ||
quotes: '\u201c\u201d\u2018\u2019' /* “”‘’ */, | ||
@@ -22,0 +22,0 @@ // Highlighter function. Should return escaped HTML, |
@@ -310,3 +310,3 @@ 'use strict'; | ||
} | ||
return ' <a href="#' + id + '" class="footnote-backref">↩</a>'; | ||
return ' <a href="#' + id + '" class="footnote-backref">\u21a9</a>'; /* ↩ */ | ||
}; | ||
@@ -313,0 +313,0 @@ |
@@ -151,17 +151,7 @@ // Ruler is helper class to build responsibility chains from parse rules. | ||
// Enable list of rules by names. If `strict` is true, then all non listed | ||
// rules will be disabled. | ||
// Enable rules by names. | ||
// | ||
Ruler.prototype.enable = function (list, strict) { | ||
if (!Array.isArray(list)) { | ||
list = [ list ]; | ||
} | ||
Ruler.prototype.enable = function (list, ignoreInvalid) { | ||
if (!Array.isArray(list)) { list = [ list ]; } | ||
// In strict mode disable all existing rules first | ||
if (strict) { | ||
this.__rules__.forEach(function (rule) { | ||
rule.enabled = false; | ||
}); | ||
} | ||
// Search by name and enable | ||
@@ -171,5 +161,7 @@ list.forEach(function (name) { | ||
if (idx < 0) { throw new Error('Rules manager: invalid rule name ' + name); } | ||
if (idx < 0) { | ||
if (ignoreInvalid) { return; } | ||
throw new Error('Rules manager: invalid rule name ' + name); | ||
} | ||
this.__rules__[idx].enabled = true; | ||
}, this); | ||
@@ -181,5 +173,16 @@ | ||
// Disable list of rules by names. | ||
// Enable rules by whitelisted names (others will be disables). | ||
// | ||
Ruler.prototype.disable = function (list) { | ||
Ruler.prototype.enableOnly = function (list, ignoreInvalid) { | ||
if (!Array.isArray(list)) { list = [ list ]; } | ||
this.__rules__.forEach(function (rule) { rule.enabled = false; }); | ||
this.enable(list, ignoreInvalid); | ||
}; | ||
// Disable rules by names. | ||
// | ||
Ruler.prototype.disable = function (list, ignoreInvalid) { | ||
if (!Array.isArray(list)) { | ||
@@ -193,5 +196,7 @@ list = [ list ]; | ||
if (idx < 0) { throw new Error('Rules manager: invalid rule name ' + name); } | ||
if (idx < 0) { | ||
if (ignoreInvalid) { return; } | ||
throw new Error('Rules manager: invalid rule name ' + name); | ||
} | ||
this.__rules__[idx].enabled = false; | ||
}, this); | ||
@@ -198,0 +203,0 @@ |
@@ -9,3 +9,3 @@ // Convert straight quotation marks to typographic ones | ||
var PUNCT_RE = /[-\s()\[\]]/; | ||
var APOSTROPHE = '’'; | ||
var APOSTROPHE = '\u2019'; /* ’ */ | ||
@@ -12,0 +12,0 @@ // This function returns true if the character at `pos` |
{ | ||
"name": "markdown-it", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Markdown parser with plugins", | ||
@@ -8,3 +8,4 @@ "keywords": [ | ||
"parser", | ||
"commonmark" | ||
"commonmark", | ||
"markdown-it" | ||
], | ||
@@ -39,2 +40,3 @@ "homepage": "https://github.com/markdown-it/markdown-it", | ||
"jade": "^1.6.0", | ||
"markdown-it-testgen": "~ 0.1.0", | ||
"marked": "0.3.2", | ||
@@ -41,0 +43,0 @@ "stylus": "^0.49.1", |
# markdown-it | ||
[![Build Status](https://travis-ci.org/markdown-it/markdown-it.svg?branch=master)](https://travis-ci.org/markdown-it/markdown-it) | ||
[![Build Status](https://img.shields.io/travis/markdown-it/markdown-it/master.svg?style=flat)](https://travis-ci.org/markdown-it/markdown-it) | ||
[![NPM version](https://img.shields.io/npm/v/markdown-it.svg?style=flat)](https://www.npmjs.org/package/markdown-it) | ||
@@ -9,3 +9,3 @@ [![Coverage Status](https://img.shields.io/coveralls/markdown-it/markdown-it/master.svg?style=flat)](https://coveralls.io/r/markdown-it/markdown-it?branch=dev) | ||
__[Live demo](http://markdown-it.github.io/markdown-it/demo/)__ | ||
__[Live demo](https://markdown-it.github.io)__ | ||
@@ -36,17 +36,15 @@ - Supports the [CommonMark](http://commonmark.org/) spec + | ||
```js | ||
// Sugar notation | ||
// node.js, standard way: | ||
var MarkdownIt = require('markdown-it'), | ||
md = new MarkdownIt(); | ||
console.log(md.render('# markdown-it rulezz!')); | ||
// node.js, the same, but with sugar: | ||
var md = require('markdown-it')(); | ||
// Or honestly as class: | ||
// | ||
// var MarkdownIt = require('markdown-it'); | ||
// var md = new MarkdownIt(); | ||
console.log(md.render('# markdown-it rulezz!')); | ||
// => <h1>markdown-it rulezz!</h1> | ||
``` | ||
In browser, when loaded global (without require.js): | ||
```js | ||
// browser without AMD, added to "window" on script load | ||
// Note, there are no dash. | ||
var md = window.markdownit(); | ||
console.log(md.render('# markdown-it rulezz!')); | ||
``` | ||
@@ -62,4 +60,6 @@ | ||
#### constructor | ||
#### constructor(preset, options) | ||
- __preset__ (String): "full"|"commonmark"|Optional. | ||
Define options in the constructor: | ||
@@ -66,0 +66,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14715
545677
15