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

remark-comment-config

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-comment-config - npm Package Compare versions

Comparing version 7.0.1 to 8.0.0

lib/index.d.ts

12

index.d.ts

@@ -1,11 +0,1 @@

/**
* Plugin to configure remark with comments.
*
* @type {import('unified').Plugin<void[], Root>}
*/
export default function remarkCommentConfig():
| void
| import('unified').Transformer<import('mdast').Root, import('mdast').Root>
export type Root = import('mdast').Root
export type HTML = import('mdast').HTML
export type Extension = import('mdast-util-to-markdown').Options
export { default } from "./lib/index.js";

@@ -1,43 +0,1 @@

/**
* @typedef {import('mdast').Root} Root
* @typedef {import('mdast').HTML} HTML
* @typedef {import('mdast-util-to-markdown').Options} Extension
*/
import {commentMarker} from 'mdast-comment-marker'
/**
* Plugin to configure remark with comments.
*
* @type {import('unified').Plugin<void[], Root>}
*/
export default function remarkCommentConfig() {
const data = this.data()
/** @type {Extension} */
const commentConfig = {
handlers: {
/** @param {HTML} node */
html(node) {
const marker = commentMarker(node)
if (marker && marker.name === 'remark') {
Object.assign(this.options, marker.parameters)
}
// Like the source:
// <https://github.com/syntax-tree/mdast-util-to-markdown/blob/e40e015/lib/handle/html.js#L4>
return node.value || ''
}
}
}
const extensions = /** @type {Extension[]} */ (
// Other extensions
/* c8 ignore next 2 */
data.toMarkdownExtensions
? data.toMarkdownExtensions
: (data.toMarkdownExtensions = [])
)
extensions.push(commentConfig)
}
export {default} from './lib/index.js'
{
"name": "remark-comment-config",
"version": "7.0.1",
"version": "8.0.0",
"description": "remark plugin to configure it with comments",
"license": "MIT",
"keywords": [
"unified",
"comment",
"config",
"markdown",
"mdast",
"options",
"plugin",
"remark",
"remark-plugin",
"plugin",
"mdast",
"markdown",
"comment",
"options",
"config",
"settings"
"settings",
"unified"
],

@@ -30,5 +30,5 @@ "repository": "remarkjs/remark-comment-config",

"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts",

@@ -38,44 +38,39 @@ "index.js"

"dependencies": {
"@types/mdast": "^3.0.0",
"mdast-comment-marker": "^2.0.0",
"mdast-util-to-markdown": "^1.0.0",
"unified": "^10.0.0"
"@types/mdast": "^4.0.0",
"mdast-comment-marker": "^3.0.0",
"unified": "^11.0.0"
},
"devDependencies": {
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"rehype-stringify": "^9.0.0",
"remark-cli": "^10.0.0",
"remark-parse": "^10.0.0",
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"prettier": "^3.0.0",
"rehype-stringify": "^10.0.0",
"remark-cli": "^11.0.0",
"remark-parse": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"remark-rehype": "^10.0.0",
"remark-stringify": "^10.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"remark-rehype": "^11.0.0",
"remark-stringify": "^11.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.46.0"
"typescript": "^5.0.0",
"xo": "^0.56.0"
},
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . --frail --output --quiet && prettier . --log-level warn --write && xo --fix",
"prepack": "npm run build && npm run format",
"test": "npm run build && npm run format && npm run test-coverage",
"test-api": "node --conditions development test.js",
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
"test-coverage": "c8 --100 --reporter lcov npm run test-api"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},
"xo": {
"prettier": true
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
"remark-preset-wooorm"
]

@@ -86,5 +81,8 @@ },

"detail": true,
"strict": true,
"ignoreCatch": true
"ignoreCatch": true,
"strict": true
},
"xo": {
"prettier": true
}
}

@@ -33,8 +33,2 @@ # remark-comment-config

**unified** is a project that transforms content with abstract syntax trees
(ASTs).
**remark** adds support for markdown to unified.
**mdast** is the markdown AST that remark uses.
This is a remark plugin that configures how `remark-stringify` serializes mdast.
## When should I use this?

@@ -54,4 +48,4 @@

This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:

@@ -62,13 +56,13 @@ ```sh

In Deno with [Skypack][]:
In Deno with [`esm.sh`][esmsh]:
```js
import remarkCommentConfig from 'https://cdn.skypack.dev/remark-comment-config@7?dts'
import remarkCommentConfig from 'https://esm.sh/remark-comment-config@8'
```
In browsers with [Skypack][]:
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import remarkCommentConfig from 'https://cdn.skypack.dev/remark-comment-config@7?min'
import remarkCommentConfig from 'https://esm.sh/remark-comment-config@8?bundle'
</script>

@@ -82,47 +76,47 @@ ```

```markdown
# Moons of Neptune
<!--remark bullet="+"-->
- a
- Naiad
<!--remark bullet="-"-->
- b
- Thalassa
<!--remark bullet="*"-->
- c
- Despina
```
And our module `example.js` looks as follows:
…and a module `example.js`:
```js
import {read} from 'to-vfile'
import {remark} from 'remark'
import remarkCommentConfig from 'remark-comment-config'
import {read} from 'to-vfile'
main()
const file = await remark()
.use(remarkCommentConfig)
.process(await read('example.md'))
async function main() {
const file = await remark()
.use(remarkCommentConfig)
.process(await read('example.md'))
console.log(String(file))
}
console.log(String(file))
```
Now running `node example.js` yields:
…then running `node example.js` yields:
```markdown
# Moons of Neptune
<!--remark bullet="+"-->
+ a
+ Naiad
<!--remark bullet="-"-->
- b
- Thalassa
<!--remark bullet="*"-->
* c
* Despina
```

@@ -133,3 +127,3 @@

This package exports no identifiers.
The default export is `remarkCommentConfig`.
The default export is [`remarkCommentConfig`][api-remark-comment-config].

@@ -139,20 +133,30 @@ ### `unified().use(remarkCommentConfig)`

Configure remark with comments.
There are no options.
Comments should start with `remark` and contain “attributes” for settings.
For example, `<!--remark foo="bar" baz-->`.
The settings are passed to [`remark-stringify`][stringify-settings].
The settings are passed to [`remark-stringify`][remark-stringify-options].
###### Parameters
There are no parameters.
###### Returns
Nothing (`undefined`).
## Types
This package is fully typed with [TypeScript][].
There are no extra exported types.
It exports no additional types.
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `remark-comment-config@^8`,
compatible with Node.js 16.
This plugin works with `remark` version 13+.

@@ -165,3 +169,3 @@ Version 5 (and lower) worked with older versions of remark.

If the markdown is user provided, this may open you up to a
[cross-site scripting (XSS)][xss] attack.
[cross-site scripting (XSS)][wiki-xss] attack.

@@ -203,5 +207,5 @@ ## Related

[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-comment-config.svg
[size-badge]: https://img.shields.io/bundlejs/size/remark-comment-config
[size]: https://bundlephobia.com/result?p=remark-comment-config
[size]: https://bundlejs.com/?q=remark-comment-config

@@ -220,11 +224,13 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg

[skypack]: https://www.skypack.dev
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[health]: https://github.com/remarkjs/.github
[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md
[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md
[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md
[support]: https://github.com/remarkjs/.github/blob/main/support.md
[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md
[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md

@@ -237,12 +243,14 @@ [license]: license

[unified]: https://github.com/unifiedjs/unified
[remark-message-control]: https://github.com/remarkjs/remark-message-control
[remark-stringify-options]: https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/readme.md#options
[remark-yaml-config]: https://github.com/remarkjs/remark-yaml-config
[typescript]: https://www.typescriptlang.org
[stringify-settings]: https://github.com/remarkjs/remark/blob/HEAD/packages/remark-stringify/readme.md#options
[unified]: https://github.com/unifiedjs/unified
[remark-yaml-config]: https://github.com/remarkjs/remark-yaml-config
[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
[remark-message-control]: https://github.com/remarkjs/remark-message-control
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
[api-remark-comment-config]: #unifieduseremarkcommentconfig
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