remark-rehype
Advanced tools
Comparing version 3.0.0 to 3.0.1
25
index.js
@@ -1,6 +0,6 @@ | ||
'use strict'; | ||
'use strict' | ||
var mdast2hast = require('mdast-util-to-hast'); | ||
var mdast2hast = require('mdast-util-to-hast') | ||
module.exports = remark2rehype; | ||
module.exports = remark2rehype | ||
@@ -14,7 +14,7 @@ /* Attacher. | ||
if (destination && !destination.process) { | ||
options = destination; | ||
destination = null; | ||
options = destination | ||
destination = null | ||
} | ||
return destination ? bridge(destination, options) : mutate(options); | ||
return destination ? bridge(destination, options) : mutate(options) | ||
} | ||
@@ -25,7 +25,9 @@ | ||
function bridge(destination, options) { | ||
return transformer; | ||
return transformer | ||
function transformer(node, file, next) { | ||
destination.run(mdast2hast(node, options), file, done); | ||
destination.run(mdast2hast(node, options), file, done) | ||
function done(err) { | ||
next(err); | ||
next(err) | ||
} | ||
@@ -37,6 +39,7 @@ } | ||
function mutate(options) { | ||
return transformer; | ||
return transformer | ||
function transformer(node) { | ||
return mdast2hast(node, options); | ||
return mdast2hast(node, options) | ||
} | ||
} |
{ | ||
"name": "remark-rehype", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "rehype support for remark", | ||
@@ -12,4 +12,4 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/remark-rehype", | ||
"bugs": "https://github.com/wooorm/remark-rehype/issues", | ||
"repository": "remarkjs/remark-rehype", | ||
"bugs": "https://github.com/remarkjs/remark-rehype/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
@@ -26,23 +26,23 @@ "contributors": [ | ||
"devDependencies": { | ||
"browserify": "^14.1.0", | ||
"esmangle": "^1.0.1", | ||
"nyc": "^11.0.0", | ||
"rehype-stringify": "^3.0.0", | ||
"remark-cli": "^4.0.0", | ||
"remark-parse": "^4.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"remark-stringify": "^4.0.0", | ||
"browserify": "^16.0.0", | ||
"nyc": "^12.0.0", | ||
"prettier": "^1.14.2", | ||
"rehype-stringify": "^4.0.0", | ||
"remark-cli": "^5.0.0", | ||
"remark-parse": "^5.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"remark-stringify": "^5.0.0", | ||
"tape": "^4.0.0", | ||
"unified": "^6.0.0", | ||
"xo": "^0.18.0" | ||
"tinyify": "^2.4.3", | ||
"unified": "^7.0.0", | ||
"xo": "^0.22.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js --bare -s remarkRehype > remark-rehype.js", | ||
"build-mangle": "esmangle remark-rehype.js > remark-rehype.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint": "xo", | ||
"test-api": "node test.js", | ||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
"build-bundle": "browserify . -s remarkRehype > remark-rehype.js", | ||
"build-mangle": "browserify . -s remarkRehype -p tinyify > remark-rehype.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 +55,12 @@ "nyc": { | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
}, | ||
"xo": { | ||
"space": true, | ||
"prettier": true, | ||
"esnext": false, | ||
@@ -59,0 +67,0 @@ "ignores": [ |
@@ -31,10 +31,10 @@ # remark-rehype [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
```javascript | ||
var vfile = require('to-vfile'); | ||
var report = require('vfile-reporter'); | ||
var unified = require('unified'); | ||
var markdown = require('remark-parse'); | ||
var remark2rehype = require('remark-rehype'); | ||
var doc = require('rehype-document'); | ||
var format = require('rehype-format'); | ||
var html = require('rehype-stringify'); | ||
var vfile = require('to-vfile') | ||
var report = require('vfile-reporter') | ||
var unified = require('unified') | ||
var markdown = require('remark-parse') | ||
var remark2rehype = require('remark-rehype') | ||
var doc = require('rehype-document') | ||
var format = require('rehype-format') | ||
var html = require('rehype-stringify') | ||
@@ -47,6 +47,6 @@ unified() | ||
.use(html) | ||
.process(vfile.readSync('example.md'), function (err, file) { | ||
console.error(report(err || file)); | ||
console.log(String(file)); | ||
}); | ||
.process(vfile.readSync('example.md'), function(err, file) { | ||
console.error(report(err || file)) | ||
console.log(String(file)) | ||
}) | ||
``` | ||
@@ -98,9 +98,17 @@ | ||
— Properly deal with HTML in markdown (used after `remark-rehype`) | ||
* [`rehype-remark`](https://github.com/wooorm/rehype-remark) | ||
* [`rehype-remark`](https://github.com/rehypejs/rehype-remark) | ||
— Transform HTML to markdown | ||
* [`rehype-retext`](https://github.com/wooorm/rehype-retext) | ||
* [`rehype-retext`](https://github.com/rehypejs/rehype-retext) | ||
— Transform HTML to [NLCST][] | ||
* [`remark-retext`](https://github.com/wooorm/remark-retext) | ||
* [`remark-retext`](https://github.com/remarkjs/remark-retext) | ||
— Transform markdown to [NLCST][] | ||
## Contribute | ||
See [`contributing.md` in `remarkjs/remark`][contributing] 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 | ||
@@ -112,9 +120,9 @@ | ||
[travis-badge]: https://img.shields.io/travis/wooorm/remark-rehype.svg | ||
[travis-badge]: https://img.shields.io/travis/remarkjs/remark-rehype.svg | ||
[travis]: https://travis-ci.org/wooorm/remark-rehype | ||
[travis]: https://travis-ci.org/remarkjs/remark-rehype | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/remark-rehype.svg | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-rehype.svg | ||
[codecov]: https://codecov.io/github/wooorm/remark-rehype | ||
[codecov]: https://codecov.io/github/remarkjs/remark-rehype | ||
@@ -127,18 +135,22 @@ [npm-install]: https://docs.npmjs.com/cli/install | ||
[mdast]: https://github.com/wooorm/mdast | ||
[mdast]: https://github.com/syntax-tree/mdast | ||
[hast]: https://github.com/wooorm/hast | ||
[hast]: https://github.com/syntax-tree/hast | ||
[remark]: https://github.com/wooorm/remark | ||
[remark]: https://github.com/remarkjs/remark | ||
[rehype]: https://github.com/wooorm/rehype | ||
[rehype]: https://github.com/rehypejs/rehype | ||
[processor]: https://github.com/wooorm/unified#processor | ||
[processor]: https://github.com/unifiedjs/unified#processor | ||
[bridge]: https://github.com/wooorm/unified#bridge | ||
[bridge]: https://github.com/unifiedjs/unified#processing-between-syntaxes | ||
[to-hast]: https://github.com/wooorm/mdast-util-to-hast#tohastnode-options | ||
[to-hast]: https://github.com/syntax-tree/mdast-util-to-hast#tohastnode-options | ||
[nlcst]: https://github.com/syntax-tree/nlcst | ||
[raw]: https://github.com/wooorm/rehype-raw | ||
[raw]: https://github.com/rehypejs/rehype-raw | ||
[contributing]: https://github.com/remarkjs/remark/blob/master/contributing.md | ||
[coc]: https://github.com/remarkjs/remark/blob/master/code-of-conduct.md |
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
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
7847
152
12