remark-comment-config
Advanced tools
Comparing version 5.0.2 to 5.0.3
40
index.js
@@ -1,25 +0,25 @@ | ||
'use strict'; | ||
'use strict' | ||
var commentMarker = require('mdast-comment-marker'); | ||
var commentMarker = require('mdast-comment-marker') | ||
module.exports = commentconfig; | ||
module.exports = commentconfig | ||
/* Modify `processor` to read configuration from comments. */ | ||
function commentconfig() { | ||
var proto = this.Parser && this.Parser.prototype; | ||
var Compiler = this.Compiler; | ||
var block = proto && proto.blockTokenizers; | ||
var inline = proto && proto.inlineTokenizers; | ||
var compiler = Compiler && Compiler.prototype && Compiler.prototype.visitors; | ||
var proto = this.Parser && this.Parser.prototype | ||
var Compiler = this.Compiler | ||
var block = proto && proto.blockTokenizers | ||
var inline = proto && proto.inlineTokenizers | ||
var compiler = Compiler && Compiler.prototype && Compiler.prototype.visitors | ||
if (block && block.html) { | ||
block.html = factory(block.html); | ||
block.html = factory(block.html) | ||
} | ||
if (inline && inline.html) { | ||
inline.html = factory(inline.html); | ||
inline.html = factory(inline.html) | ||
} | ||
if (compiler && compiler.html) { | ||
compiler.html = factory(compiler.html); | ||
compiler.html = factory(compiler.html) | ||
} | ||
@@ -30,22 +30,22 @@ } | ||
function factory(original) { | ||
replacement.locator = original.locator; | ||
replacement.locator = original.locator | ||
return replacement; | ||
return replacement | ||
/* Replacer for tokeniser or visitor. */ | ||
function replacement(node) { | ||
var self = this; | ||
var result = original.apply(self, arguments); | ||
var marker = commentMarker(result && result.type ? result : node); | ||
var self = this | ||
var result = original.apply(self, arguments) | ||
var marker = commentMarker(result && result.type ? result : node) | ||
if (marker && marker.name === 'remark') { | ||
try { | ||
self.setOptions(marker.parameters); | ||
} catch (err) { | ||
self.file.fail(err.message, marker.node); | ||
self.setOptions(marker.parameters) | ||
} catch (error) { | ||
self.file.fail(error.message, marker.node) | ||
} | ||
} | ||
return result; | ||
return result | ||
} | ||
} |
{ | ||
"name": "remark-comment-config", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Configure remark with comments", | ||
@@ -15,5 +15,5 @@ "license": "MIT", | ||
"bugs": "https://github.com/remarkjs/remark-comment-config/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"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,24 +27,24 @@ "dependencies": { | ||
"devDependencies": { | ||
"browserify": "^14.0.0", | ||
"esmangle": "^1.0.0", | ||
"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", | ||
"browserify": "^16.0.0", | ||
"nyc": "^13.0.0", | ||
"prettier": "^1.14.2", | ||
"rehype-stringify": "^5.0.0", | ||
"remark-cli": "^6.0.0", | ||
"remark-parse": "^6.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"remark-rehype": "^3.0.0", | ||
"remark-stringify": "^4.0.0", | ||
"remark-stringify": "^6.0.0", | ||
"tape": "^4.4.0", | ||
"unified": "^6.0.0", | ||
"xo": "^0.18.0" | ||
"tinyify": "^2.4.3", | ||
"unified": "^7.0.0", | ||
"xo": "^0.23.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js -s remarkCommentConfig > remark-comment-config.js", | ||
"build-mangle": "esmangle remark-comment-config.js > remark-comment-config.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint": "xo", | ||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
"build-bundle": "browserify . -s remarkCommentConfig > remark-comment-config.js", | ||
"build-mangle": "browserify . -s remarkCommentConfig -p tinyify > remark-comment-config.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" | ||
}, | ||
@@ -57,4 +57,12 @@ "nyc": { | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
}, | ||
"xo": { | ||
"space": true, | ||
"prettier": true, | ||
"esnext": false, | ||
@@ -61,0 +69,0 @@ "ignores": [ |
@@ -1,3 +0,10 @@ | ||
# remark-comment-config [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] | ||
# remark-comment-config | ||
[![Build][build-badge]][build] | ||
[![Coverage][coverage-badge]][coverage] | ||
[![Downloads][downloads-badge]][downloads] | ||
[![Chat][chat-badge]][chat] | ||
[![Sponsors][sponsors-badge]][collective] | ||
[![Backers][backers-badge]][collective] | ||
Configure [**remark**][remark] with comments. | ||
@@ -28,12 +35,12 @@ | ||
```javascript | ||
var vfile = require('to-vfile'); | ||
var remark = require('remark'); | ||
var commentConfig = require('remark-comment-config'); | ||
var vfile = require('to-vfile') | ||
var remark = require('remark') | ||
var commentConfig = require('remark-comment-config') | ||
remark() | ||
.use(commentConfig) | ||
.process(vfile.readSync('example.md'), function (err, file) { | ||
if (err) throw err; | ||
console.log(String(file)); | ||
}); | ||
.process(vfile.readSync('example.md'), function(err, file) { | ||
if (err) throw err | ||
console.log(String(file)) | ||
}) | ||
``` | ||
@@ -70,3 +77,3 @@ | ||
See [`contribute.md` in `remarkjs/remarkjs`][contribute] for ways to get | ||
See [`contributing.md` in `remarkjs/remark`][contributing] for ways to get | ||
started. | ||
@@ -85,16 +92,26 @@ | ||
[build-status]: https://travis-ci.org/remarkjs/remark-comment-config | ||
[build]: https://travis-ci.org/remarkjs/remark-comment-config | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-comment-config.svg | ||
[coverage-status]: https://codecov.io/github/remarkjs/remark-comment-config | ||
[coverage]: https://codecov.io/github/remarkjs/remark-comment-config | ||
[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg | ||
[downloads-badge]: https://img.shields.io/npm/dm/remark-comment-config.svg | ||
[chat]: https://gitter.im/remarkjs/Lobby | ||
[downloads]: https://www.npmjs.com/package/remark-comment-config | ||
[license]: LICENSE | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[author]: http://wooorm.com | ||
[chat]: https://spectrum.chat/unified/remark | ||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg | ||
[collective]: https://opencollective.com/unified | ||
[license]: license | ||
[author]: https://wooorm.com | ||
[npm]: https://docs.npmjs.com/cli/install | ||
@@ -112,4 +129,4 @@ | ||
[contribute]: https://github.com/remarkjs/remark/blob/master/contributing.md | ||
[contributing]: https://github.com/remarkjs/remark/blob/master/contributing.md | ||
[coc]: https://github.com/remarkjs/remark/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
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
7660
129
13