rehype-sanitize
Advanced tools
Comparing version 2.0.1 to 2.0.2
10
index.js
@@ -1,12 +0,12 @@ | ||
'use strict'; | ||
'use strict' | ||
var clean = require('hast-util-sanitize'); | ||
var clean = require('hast-util-sanitize') | ||
module.exports = sanitize; | ||
module.exports = sanitize | ||
function sanitize(options) { | ||
return transformer; | ||
return transformer | ||
function transformer(tree) { | ||
return clean(tree, options); | ||
return clean(tree, options) | ||
} | ||
} |
{ | ||
"name": "rehype-sanitize", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Sanitize HTML with rehype", | ||
@@ -13,7 +13,7 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/rehype-sanitize", | ||
"bugs": "https://github.com/wooorm/rehype-sanitize/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"repository": "rehypejs/rehype-sanitize", | ||
"bugs": "https://github.com/rehypejs/rehype-sanitize/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
"contributors": [ | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)" | ||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" | ||
], | ||
@@ -27,22 +27,21 @@ "files": [ | ||
"devDependencies": { | ||
"browserify": "^14.1.0", | ||
"deepmerge": "^1.2.0", | ||
"esmangle": "^1.0.0", | ||
"hast-util-sanitize": "^1.1.0", | ||
"nyc": "^11.0.0", | ||
"rehype": "^5.0.0", | ||
"remark-cli": "^3.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"browserify": "^16.0.0", | ||
"deepmerge": "^2.0.0", | ||
"nyc": "^13.0.0", | ||
"prettier": "^1.13.7", | ||
"rehype": "^6.0.0", | ||
"remark-cli": "^6.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"tape": "^4.0.0", | ||
"xo": "^0.18.0" | ||
"tinyify": "^2.4.3", | ||
"xo": "^0.23.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js --bare -s rehypeSanitize > rehype-sanitize.js", | ||
"build-mangle": "esmangle rehype-sanitize.js > rehype-sanitize.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint": "xo", | ||
"test-api": "node test/index.js", | ||
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", | ||
"build-bundle": "browserify index.js -s rehypeSanitize > rehype-sanitize.js", | ||
"build-mangle": "browserify index.js -s rehypeSanitize -p tinyify > rehype-sanitize.min.js", | ||
"build": "npm run build-bundle && npm run build-mangle", | ||
"test-api": "node test", | ||
"test-coverage": "nyc --reporter lcov tape test.js", | ||
"test": "npm run build && npm run lint && npm run test-coverage" | ||
"test": "npm run format && npm run build && npm run test-coverage" | ||
}, | ||
@@ -55,4 +54,12 @@ "nyc": { | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
}, | ||
"xo": { | ||
"space": true, | ||
"prettier": true, | ||
"esnext": false, | ||
@@ -64,4 +71,6 @@ "ignores": [ | ||
"remarkConfig": { | ||
"plugins": ["preset-wooorm"] | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
@@ -1,3 +0,8 @@ | ||
# rehype-sanitize [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
# rehype-sanitize | ||
[![Build][build-badge]][build] | ||
[![Coverage][coverage-badge]][coverage] | ||
[![Downloads][downloads-badge]][downloads] | ||
[![Chat][chat-badge]][chat] | ||
Sanitise HTML with [**rehype**][rehype]. | ||
@@ -34,9 +39,9 @@ | ||
```javascript | ||
var fs = require('fs'); | ||
var rehype = require('rehype'); | ||
var merge = require('deepmerge'); | ||
var gh = require('hast-util-sanitize/lib/github'); | ||
var sanitize = require('rehype-sanitize'); | ||
var fs = require('fs') | ||
var rehype = require('rehype') | ||
var merge = require('deepmerge') | ||
var gh = require('hast-util-sanitize/lib/github') | ||
var sanitize = require('rehype-sanitize') | ||
var schema = merge(gh, {tagNames: ['math', 'mi']}); | ||
var schema = merge(gh, {tagNames: ['math', 'mi']}) | ||
@@ -46,6 +51,6 @@ rehype() | ||
.use(sanitize, schema) | ||
.process(fs.readFileSync('index.html'), function (err, file) { | ||
if (err) throw err; | ||
console.log(String(file)); | ||
}); | ||
.process(fs.readFileSync('index.html'), function(err, file) { | ||
if (err) throw err | ||
console.log(String(file)) | ||
}) | ||
``` | ||
@@ -79,5 +84,13 @@ | ||
* [`hast-util-sanitize`](https://github.com/wooorm/hast-util-sanitize) | ||
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize) | ||
— Core utility that does the sanitation | ||
## Contribute | ||
See [`contributing.md` in `rehypejs/rehype`][contribute] for ways to get | ||
started. | ||
This organisation has a [Code of Conduct][coc]. By interacting with this | ||
repository, organisation, or community you agree to abide by its terms. | ||
## License | ||
@@ -89,18 +102,30 @@ | ||
[travis-badge]: https://img.shields.io/travis/wooorm/rehype-sanitize.svg | ||
[build-badge]: https://img.shields.io/travis/rehypejs/rehype-sanitize.svg | ||
[travis]: https://travis-ci.org/wooorm/rehype-sanitize | ||
[build]: https://travis-ci.org/rehypejs/rehype-sanitize | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/rehype-sanitize.svg | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-sanitize.svg | ||
[codecov]: https://codecov.io/github/wooorm/rehype-sanitize | ||
[coverage]: https://codecov.io/github/rehypejs/rehype-sanitize | ||
[downloads-badge]: https://img.shields.io/npm/dm/rehype-sanitize.svg | ||
[downloads]: https://www.npmjs.com/package/rehype-sanitize | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat]: https://spectrum.chat/unified/rehype | ||
[npm]: https://docs.npmjs.com/cli/install | ||
[license]: LICENSE | ||
[license]: license | ||
[author]: http://wooorm.com | ||
[author]: https://wooorm.com | ||
[rehype]: https://github.com/wooorm/rehype | ||
[rehype]: https://github.com/rehypejs/rehype | ||
[schema]: https://github.com/wooorm/hast-util-sanitize#schema | ||
[schema]: https://github.com/syntax-tree/hast-util-sanitize#schema | ||
[contribute]: https://github.com/rehypejs/rehype/blob/master/contributing.md | ||
[coc]: https://github.com/rehypejs/rehype/blob/master/code-of-conduct.md |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
6046
128