Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-yaml-config

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-yaml-config - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

40

index.js

@@ -1,20 +0,20 @@

'use strict';
'use strict'
var jsYAML = require('js-yaml');
var jsYAML = require('js-yaml')
module.exports = yamlConfig;
module.exports = yamlConfig
/* Modify remark to read configuration from comments. */
function yamlConfig() {
var Parser = this.Parser;
var Compiler = this.Compiler;
var parser = Parser && Parser.prototype.blockTokenizers;
var compiler = Compiler && Compiler.prototype.visitors;
var Parser = this.Parser
var Compiler = this.Compiler
var parser = Parser && Parser.prototype.blockTokenizers
var compiler = Compiler && Compiler.prototype.visitors
if (parser && parser.yamlFrontMatter) {
parser.yamlFrontMatter = factory(parser.yamlFrontMatter);
parser.yamlFrontMatter = factory(parser.yamlFrontMatter)
}
if (compiler && compiler.yaml) {
compiler.yaml = factory(compiler.yaml);
compiler.yaml = factory(compiler.yaml)
}

@@ -25,26 +25,26 @@ }

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 = result && result.type ? result : node;
var data;
var self = this
var result = original.apply(self, arguments)
var marker = result && result.type ? result : node
var data
try {
data = jsYAML.safeLoad(marker.value);
data = data && data.remark;
data = jsYAML.safeLoad(marker.value)
data = data && data.remark
if (data) {
self.setOptions(data);
self.setOptions(data)
}
} catch (err) {
self.file.fail(err.message, marker);
self.file.fail(err.message, marker)
}
return result;
return result
}
}
{
"name": "remark-yaml-config",
"version": "4.0.1",
"version": "4.0.2",
"description": "Configure remark with YAML front-matter",

@@ -13,4 +13,4 @@ "license": "MIT",

],
"repository": "https://github.com/wooorm/remark-yaml-config",
"bugs": "https://github.com/wooorm/remark-yaml-config/issues",
"repository": "remarkjs/remark-yaml-config",
"bugs": "https://github.com/remarkjs/remark-yaml-config/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

@@ -27,22 +27,23 @@ "contributors": [

"devDependencies": {
"browserify": "^14.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"remark": "^7.0.0",
"remark-cli": "^3.0.0",
"remark-html": "^6.0.0",
"remark-preset-wooorm": "^3.0.0",
"browserify": "^16.0.0",
"nyc": "^12.0.0",
"prettier": "^1.14.2",
"remark": "^9.0.0",
"remark-cli": "^5.0.0",
"remark-frontmatter": "^1.0.0",
"remark-html": "^8.0.0",
"remark-preset-wooorm": "^4.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-bundle": "browserify --no-builtins index.js -s remarkYAMLConfig > remark-yaml-config.js",
"build-mangle": "esmangle remark-yaml-config.js > remark-yaml-config.min.js",
"build-md": "remark . -qfo",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint": "xo",
"test-api": "node test.js",
"test-coverage": "nyc --reporter lcov tape test/index.js",
"test": "npm run build && npm run lint && npm run test-coverage"
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s remarkYamlConfig > remark-yaml-config.js",
"build-mangle": "browserify . -s remarkYamlConfig -p tinyify > remark-yaml-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 format && npm run build && npm run test-coverage"
},

@@ -55,4 +56,12 @@ "nyc": {

},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"space": true,
"prettier": true,
"esnext": false,

@@ -69,4 +78,6 @@ "rules": {

"remarkConfig": {
"plugins": ["preset-wooorm"]
"plugins": [
"preset-wooorm"
]
}
}
# remark-yaml-config [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat]
Configure [**remark**][remark] with YAML front-matter.
Configure [**remark**][remark] with YAML front-matter. This requires
[`remark-frontmatter`][remark-frontmatter] as well.

@@ -26,3 +27,3 @@ ## Installation

* Hello (this is a stringification setting)
* Hello (this is a stringify setting)
```

@@ -33,12 +34,14 @@

```javascript
var vfile = require('to-vfile');
var remark = require('remark');
var yamlConfig = require('remark-yaml-config');
var vfile = require('to-vfile')
var remark = require('remark')
var frontmatter = require('remark-frontmatter')
var yamlConfig = require('remark-yaml-config')
remark()
.use(frontmatter)
.use(yamlConfig)
.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))
})
```

@@ -57,3 +60,3 @@

* Hello (this is a stringification setting)
* Hello (this is a stringify setting)
```

@@ -66,7 +69,22 @@

Passes the configuration at the `remark` field as [parse][parse-settings]
and [stringify][stringify-settings] settings.
and [stringify][stringify-settings] settings to **remark**.
Just like [**remark-comment-config**][remark-comment-config], but YAML is
Just like [`remark-comment-config`][remark-comment-config], but YAML is
more visible.
## Related
* [`remark-comment-config`][remark-comment-config]
— Configure with comments
* [`remark-frontmatter`][remark-frontmatter]
— Frontmatter support, including yaml, toml, and more
## 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

@@ -78,13 +96,13 @@

[build-badge]: https://img.shields.io/travis/wooorm/remark-yaml-config.svg
[build-badge]: https://img.shields.io/travis/remarkjs/remark-yaml-config.svg
[build-status]: https://travis-ci.org/wooorm/remark-yaml-config
[build-status]: https://travis-ci.org/remarkjs/remark-yaml-config
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/remark-yaml-config.svg
[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-yaml-config.svg
[coverage-status]: https://codecov.io/github/wooorm/remark-yaml-config
[coverage-status]: https://codecov.io/github/remarkjs/remark-yaml-config
[chat-badge]: https://img.shields.io/gitter/room/wooorm/remark.svg
[chat-badge]: https://img.shields.io/gitter/room/remarkjs/Lobby.svg
[chat]: https://gitter.im/wooorm/remark
[chat]: https://gitter.im/remarkjs/Lobby

@@ -97,8 +115,14 @@ [license]: LICENSE

[remark]: https://github.com/wooorm/remark
[remark]: https://github.com/remarkjs/remark
[parse-settings]: https://github.com/wooorm/remark/blob/master/packages/remark-parse/readme.md#options
[parse-settings]: https://github.com/remarkjs/remark/blob/master/packages/remark-parse/readme.md#options
[stringify-settings]: https://github.com/wooorm/remark/blob/master/packages/remark-stringify/readme.md#options
[stringify-settings]: https://github.com/remarkjs/remark/blob/master/packages/remark-stringify/readme.md#options
[remark-comment-config]: https://github.com/wooorm/remark-comment-config
[remark-comment-config]: https://github.com/remarkjs/remark-comment-config
[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter
[contributing]: https://github.com/remarkjs/remark/blob/master/contributing.md
[coc]: https://github.com/remarkjs/remark/blob/master/code-of-conduct.md
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc