remark-html
Advanced tools
Comparing version 12.0.0 to 13.0.0
14
index.js
'use strict' | ||
var xtend = require('xtend') | ||
var toHast = require('mdast-util-to-hast') | ||
@@ -20,3 +19,7 @@ var toHtml = require('hast-util-to-html') | ||
var root = node && node.type && node.type === 'root' | ||
var hast = toHast(node, {allowDangerousHtml: !clean, handlers: handlers}) | ||
var hast = toHast(node, { | ||
allowDangerousHtml: !clean, | ||
handlers: handlers, | ||
commonmark: true | ||
}) | ||
var result | ||
@@ -32,6 +35,9 @@ | ||
result = toHtml(hast, xtend(settings, {allowDangerousHtml: !clean})) | ||
result = toHtml( | ||
hast, | ||
Object.assign({}, settings, {allowDangerousHtml: !clean}) | ||
) | ||
// Add an eof eol. | ||
if (root && result.charAt(result.length - 1) !== '\n') { | ||
if (root && result && /[^\r\n]/.test(result.charAt(result.length - 1))) { | ||
result += '\n' | ||
@@ -38,0 +44,0 @@ } |
{ | ||
"name": "remark-html", | ||
"version": "12.0.0", | ||
"version": "13.0.0", | ||
"description": "remark plugin to compile Markdown to HTML", | ||
@@ -39,4 +39,3 @@ "license": "MIT", | ||
"hast-util-to-html": "^7.0.0", | ||
"mdast-util-to-hast": "^9.0.0", | ||
"xtend": "^4.0.1" | ||
"mdast-util-to-hast": "^9.0.0" | ||
}, | ||
@@ -46,16 +45,20 @@ "devDependencies": { | ||
"commonmark.json": "^0.29.0", | ||
"dtslint": "^3.0.0", | ||
"dtslint": "^4.0.0", | ||
"is-hidden": "^1.0.0", | ||
"not": "^0.1.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^2.0.0", | ||
"remark": "^12.0.0", | ||
"rehype-parse": "^7.0.0", | ||
"rehype-stringify": "^8.0.0", | ||
"remark": "^13.0.0-alpha.0", | ||
"remark-cli": "^8.0.0", | ||
"remark-github": "^9.0.0", | ||
"remark-preset-wooorm": "^7.0.0", | ||
"remark-slug": "^6.0.0", | ||
"remark-toc": "^7.0.0", | ||
"tape": "^5.0.0", | ||
"tinyify": "^2.0.0", | ||
"tinyify": "^3.0.0", | ||
"to-vfile": "^6.0.0", | ||
"unified": "^9.0.0", | ||
"xo": "^0.32.0" | ||
"xo": "^0.33.0" | ||
}, | ||
@@ -91,3 +94,4 @@ "scripts": { | ||
"unicorn/no-fn-reference-in-iterator": "off", | ||
"unicorn/prefer-includes": "off" | ||
"unicorn/prefer-includes": "off", | ||
"unicorn/prefer-optional-catch-binding": "off" | ||
}, | ||
@@ -94,0 +98,0 @@ "ignores": [ |
@@ -19,2 +19,9 @@ # remark-html | ||
## Note! | ||
This plugin is ready for the new parser in remark | ||
([`remarkjs/remark#536`](https://github.com/remarkjs/remark/pull/536)). | ||
The current and previous version of the plugin works with the current and | ||
previous version of remark. | ||
## Install | ||
@@ -51,3 +58,3 @@ | ||
.use(html) | ||
.process(fs.readFileSync('example.md'), function(err, file) { | ||
.process(fs.readFileSync('example.md'), function (err, file) { | ||
if (err) throw err | ||
@@ -84,3 +91,3 @@ console.log(String(file)) | ||
Object mapping [mdast][] [nodes][mdast-node] to functions handling them. | ||
This option is passed to [`mdast-util-to-html`][to-mdast-handlers]. | ||
This option is passed to [`mdast-util-to-hast`][to-hast-handlers]. | ||
@@ -94,4 +101,4 @@ ###### `options.sanitize` | ||
* `true` | ||
— HTML is [`hast-util-sanitize`][sanitize] according to [GitHub’s sanitation | ||
rules][github], dangerous HTML is dropped | ||
— HTML is sanitized according to [GitHub’s sanitation rules][github], | ||
dangerous HTML is dropped | ||
* `Object` | ||
@@ -121,13 +128,2 @@ — the object is treated as a `schema` for how to sanitize with | ||
## CommonMark | ||
> You still need to set `commonmark: true` in [`remark-parse`s | ||
> options][remark-options]. | ||
[CommonMark][] support is a goal but not (yet) a necessity. | ||
There are some (roughly 115 of 550, relating to inline precedence, lists, | ||
emphasis and importance) issues which I’d like to cover in the future. | ||
Note that this sounds like a lot, but they have to do with obscure differences | ||
which do not often occur in the real world. | ||
## Integrations | ||
@@ -232,5 +228,5 @@ | ||
[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg | ||
[chat]: https://spectrum.chat/unified/remark | ||
[chat]: https://github.com/remarkjs/remark/discussions | ||
@@ -253,4 +249,2 @@ [npm]: https://docs.npmjs.com/cli/install | ||
[remark-options]: https://github.com/remarkjs/remark/tree/HEAD/packages/remark-parse#options | ||
[remark-plugins]: https://github.com/remarkjs/remark/blob/HEAD/doc/plugins.md#list-of-plugins | ||
@@ -274,3 +268,3 @@ | ||
[to-mdast-handlers]: https://github.com/syntax-tree/mdast-util-to-hast#optionshandlers | ||
[to-hast-handlers]: https://github.com/syntax-tree/mdast-util-to-hast#optionshandlers | ||
@@ -283,6 +277,4 @@ [sanitize]: https://github.com/syntax-tree/hast-util-sanitize | ||
[commonmark]: https://commonmark.org | ||
[integrations]: #integrations | ||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting |
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
3
53
12952
20
272
- Removedxtend@^4.0.1