markdown-it
Advanced tools
Comparing version 13.0.2 to 14.0.0
{ | ||
"name": "markdown-it", | ||
"version": "13.0.2", | ||
"version": "14.0.0", | ||
"description": "Markdown-it - modern pluggable markdown parser.", | ||
@@ -14,24 +14,32 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "index.js", | ||
"main": "dist/index.cjs.js", | ||
"module": "index.mjs", | ||
"exports": { | ||
".": { | ||
"import": "./index.mjs", | ||
"require": "./dist/index.cjs.js" | ||
}, | ||
"./*": { | ||
"require": "./*", | ||
"import": "./*" | ||
} | ||
}, | ||
"bin": { | ||
"markdown-it": "bin/markdown-it.js" | ||
"markdown-it": "bin/markdown-it.mjs" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "npm run lint && nyc mocha && node support/specsplit.js", | ||
"coverage": "npm run test && nyc report --reporter html", | ||
"report-coveralls": "nyc --reporter=lcov mocha", | ||
"doc": "node support/build_doc.js", | ||
"test": "npm run lint && CJS_ONLY=1 npm run build && c8 --exclude dist --exclude test -r text -r html -r lcov mocha && node support/specsplit.mjs", | ||
"doc": "node support/build_doc.mjs", | ||
"gh-doc": "npm run doc && gh-pages -d apidoc -f", | ||
"demo": "npm run lint && node support/build_demo.js", | ||
"demo": "npm run lint && node support/build_demo.mjs", | ||
"gh-demo": "npm run demo && gh-pages -d demo -f -b master -r git@github.com:markdown-it/markdown-it.github.io.git", | ||
"browserify": "rollup -c support/rollup.config.js", | ||
"build": "rollup -c support/rollup.config.mjs", | ||
"benchmark-deps": "npm install --prefix benchmark/extra/ -g marked@0.3.6 commonmark@0.26.0 markdown-it/markdown-it.git#2.2.1", | ||
"specsplit": "support/specsplit.js good -o test/fixtures/commonmark/good.txt && support/specsplit.js bad -o test/fixtures/commonmark/bad.txt && support/specsplit.js", | ||
"specsplit": "support/specsplit.mjs good -o test/fixtures/commonmark/good.txt && support/specsplit.mjs bad -o test/fixtures/commonmark/bad.txt && support/specsplit.mjs", | ||
"todo": "grep 'TODO' -n -r ./lib 2>/dev/null", | ||
"prepublishOnly": "npm run gh-demo && npm run gh-doc" | ||
"prepublishOnly": "npm test && npm run build && npm run gh-demo && npm run gh-doc" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"bin/", | ||
"index.mjs", | ||
"lib/", | ||
@@ -42,42 +50,39 @@ "dist/" | ||
"argparse": "^2.0.1", | ||
"entities": "~3.0.1", | ||
"linkify-it": "^4.0.1", | ||
"mdurl": "^1.0.1", | ||
"uc.micro": "^1.0.5" | ||
"entities": "^4.4.0", | ||
"linkify-it": "^5.0.0", | ||
"mdurl": "^2.0.0", | ||
"punycode.js": "^2.3.1", | ||
"uc.micro": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^16.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^10.0.0", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"ansi": "^0.3.0", | ||
"autoprefixer-stylus": "^1.0.0", | ||
"benchmark": "~2.1.0", | ||
"c8": "^8.0.1", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.4", | ||
"eslint": "^8.4.1", | ||
"eslint-config-standard": "^17.1.0", | ||
"express": "^4.14.0", | ||
"gh-pages": "^3.1.0", | ||
"highlight.js": "^10.7.2", | ||
"jest-worker": "^26.6.2", | ||
"markdown-it-abbr": "^1.0.4", | ||
"markdown-it-container": "^3.0.0", | ||
"markdown-it-deflist": "^2.0.0", | ||
"markdown-it-emoji": "^2.0.0", | ||
"markdown-it-footnote": "^3.0.1", | ||
"markdown-it-for-inline": "^0.1.0", | ||
"markdown-it-ins": "^3.0.0", | ||
"markdown-it-mark": "^3.0.0", | ||
"markdown-it-sub": "^1.0.0", | ||
"markdown-it-sup": "^1.0.0", | ||
"gh-pages": "^6.1.0", | ||
"highlight.js": "^11.9.0", | ||
"jest-worker": "^29.7.0", | ||
"markdown-it-abbr": "^2.0.0", | ||
"markdown-it-container": "^4.0.0", | ||
"markdown-it-deflist": "^3.0.0", | ||
"markdown-it-emoji": "^3.0.0", | ||
"markdown-it-footnote": "^4.0.0", | ||
"markdown-it-for-inline": "^2.0.1", | ||
"markdown-it-ins": "^4.0.0", | ||
"markdown-it-mark": "^4.0.0", | ||
"markdown-it-sub": "^2.0.0", | ||
"markdown-it-sup": "^2.0.0", | ||
"markdown-it-testgen": "^0.1.3", | ||
"mocha": "^9.1.3", | ||
"mocha": "^10.2.0", | ||
"ndoc": "^6.0.0", | ||
"needle": "^3.0.0", | ||
"nyc": "^15.0.1", | ||
"pug-cli": "^1.0.0-alpha6", | ||
"rollup": "^2.29.0", | ||
"rollup-plugin-node-polyfills": "^0.2.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup": "^4.5.0", | ||
"shelljs": "^0.8.4", | ||
"stylus": "^0.55.0", | ||
"supertest": "^6.0.1" | ||
@@ -84,0 +89,0 @@ }, |
101
README.md
@@ -62,15 +62,12 @@ # markdown-it <!-- omit in toc --> | ||
```js | ||
// node.js, "classic" way: | ||
var MarkdownIt = require('markdown-it'), | ||
md = new MarkdownIt(); | ||
var result = md.render('# markdown-it rulezz!'); | ||
// node.js | ||
// can use `require('markdown-it')` for CJS | ||
import markdownit from 'markdown-it' | ||
const md = markdownit() | ||
const result = md.render('# markdown-it rulezz!'); | ||
// node.js, the same, but with sugar: | ||
var md = require('markdown-it')(); | ||
var result = md.render('# markdown-it rulezz!'); | ||
// browser without AMD, added to "window" on script load | ||
// browser with UMD build, added to "window" on script load | ||
// Note, there is no dash in "markdownit". | ||
var md = window.markdownit(); | ||
var result = md.render('# markdown-it rulezz!'); | ||
const md = window.markdownit(); | ||
const result = md.render('# markdown-it rulezz!'); | ||
``` | ||
@@ -81,4 +78,5 @@ | ||
```js | ||
var md = require('markdown-it')(); | ||
var result = md.renderInline('__markdown-it__ rulezz!'); | ||
import markdownit from 'markdown-it' | ||
const md = markdownit() | ||
const result = md.renderInline('__markdown-it__ rulezz!'); | ||
``` | ||
@@ -94,25 +92,36 @@ | ||
```js | ||
import markdownit from 'markdown-it' | ||
// commonmark mode | ||
var md = require('markdown-it')('commonmark'); | ||
const md = markdownit('commonmark') | ||
// default mode | ||
var md = require('markdown-it')(); | ||
const md = markdownit() | ||
// enable everything | ||
var md = require('markdown-it')({ | ||
const md = markdownit({ | ||
html: true, | ||
linkify: true, | ||
typographer: true | ||
}); | ||
}) | ||
// full options list (defaults) | ||
var md = require('markdown-it')({ | ||
html: false, // Enable HTML tags in source | ||
xhtmlOut: false, // Use '/' to close single tags (<br />). | ||
// This is only for full CommonMark compatibility. | ||
breaks: false, // Convert '\n' in paragraphs into <br> | ||
langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be | ||
// useful for external highlighters. | ||
linkify: false, // Autoconvert URL-like text to links | ||
const md = markdownit({ | ||
// Enable HTML tags in source | ||
html: false, | ||
// Use '/' to close single tags (<br />). | ||
// This is only for full CommonMark compatibility. | ||
xhtmlOut: false, | ||
// Convert '\n' in paragraphs into <br> | ||
breaks: false, | ||
// CSS language prefix for fenced blocks. Can be | ||
// useful for external highlighters. | ||
langPrefix: 'language-', | ||
// Autoconvert URL-like text to links | ||
linkify: false, | ||
// Enable some language-neutral replacement + quotes beautification | ||
@@ -139,6 +148,8 @@ // For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js | ||
```js | ||
var md = require('markdown-it')() | ||
.use(plugin1) | ||
.use(plugin2, opts, ...) | ||
.use(plugin3); | ||
import markdownit from 'markdown-it' | ||
const md = markdownit | ||
.use(plugin1) | ||
.use(plugin2, opts, ...) | ||
.use(plugin3); | ||
``` | ||
@@ -152,6 +163,7 @@ | ||
```js | ||
var hljs = require('highlight.js'); // https://highlightjs.org | ||
import markdownit from 'markdown-it' | ||
import hljs from 'highlight.js' // https://highlightjs.org | ||
// Actual default values | ||
var md = require('markdown-it')({ | ||
const md = markdownit({ | ||
highlight: function (str, lang) { | ||
@@ -169,13 +181,14 @@ if (lang && hljs.getLanguage(lang)) { | ||
Or with full wrapper override (if you need assign class to `<pre>`): | ||
Or with full wrapper override (if you need assign class to `<pre>` or `<code>`): | ||
```js | ||
var hljs = require('highlight.js'); // https://highlightjs.org | ||
import markdownit from 'markdown-it' | ||
import hljs from 'highlight.js' // https://highlightjs.org | ||
// Actual default values | ||
var md = require('markdown-it')({ | ||
const md = markdownit({ | ||
highlight: function (str, lang) { | ||
if (lang && hljs.getLanguage(lang)) { | ||
try { | ||
return '<pre class="hljs"><code>' + | ||
return '<pre><code class="hljs">' + | ||
hljs.highlight(str, { language: lang, ignoreIllegals: true }).value + | ||
@@ -186,3 +199,3 @@ '</code></pre>'; | ||
return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>'; | ||
return '<pre><code class="hljs">' + md.utils.escapeHtml(str) + '</code></pre>'; | ||
} | ||
@@ -237,10 +250,12 @@ }); | ||
```js | ||
import markdownit from 'markdown-it' | ||
// Activate/deactivate rules, with currying | ||
var md = require('markdown-it')() | ||
.disable([ 'link', 'image' ]) | ||
.enable([ 'link' ]) | ||
.enable('image'); | ||
const md = markdownit() | ||
.disable(['link', 'image']) | ||
.enable(['link']) | ||
.enable('image'); | ||
// Enable everything | ||
md = require('markdown-it')({ | ||
const md = markdownit({ | ||
html: true, | ||
@@ -264,4 +279,4 @@ linkify: true, | ||
```bash | ||
make benchmark-deps | ||
benchmark/benchmark.js readme | ||
npm run benchmark-deps | ||
benchmark/benchmark.mjs readme | ||
@@ -268,0 +283,0 @@ Selected samples: (1 of 28) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
756166
31
17617
325
0
6
1
+ Addedpunycode.js@^2.3.1
+ Addedentities@4.5.0(transitive)
+ Addedlinkify-it@5.0.0(transitive)
+ Addedmdurl@2.0.0(transitive)
+ Addedpunycode.js@2.3.1(transitive)
+ Addeduc.micro@2.1.0(transitive)
- Removedentities@3.0.1(transitive)
- Removedlinkify-it@4.0.1(transitive)
- Removedmdurl@1.0.1(transitive)
- Removeduc.micro@1.0.6(transitive)
Updatedentities@^4.4.0
Updatedlinkify-it@^5.0.0
Updatedmdurl@^2.0.0
Updateduc.micro@^2.0.0