Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/remcohaszing/unified-consistency
Report inconsistencies between the input and output of a unified pipeline
https://github.com/remcohaszing/unified-consistency
rehype remark retext unified unist
Last synced: 10 days ago
JSON representation
Report inconsistencies between the input and output of a unified pipeline
- Host: GitHub
- URL: https://github.com/remcohaszing/unified-consistency
- Owner: remcohaszing
- License: mit
- Created: 2023-03-24T17:20:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T11:58:42.000Z (over 1 year ago)
- Last Synced: 2024-05-02T05:14:23.962Z (8 months ago)
- Topics: rehype, remark, retext, unified, unist
- Language: TypeScript
- Homepage:
- Size: 262 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# unified-consistency
[![github actions](https://github.com/remcohaszing/unified-consistency/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/unified-consistency/actions/workflows/ci.yaml)
[![npm version](https://img.shields.io/npm/v/unified-consistency)](https://www.npmjs.com/package/unified-consistency)
[![npm downloads](https://img.shields.io/npm/dm/unified-consistency)](https://www.npmjs.com/package/unified-consistency)[![codecov](https://codecov.io/gh/remcohaszing/unified-consistency/branch/main/graph/badge.svg)](https://codecov.io/gh/remcohaszing/unified-consistency)
A [unified](https://unifiedjs.com) plugin which reports inconsistencies between the input and what a
pipeline would output.## Table of Contents
- [Installation](#installation)
- [API](#api)
- [Options](#options)
- [Compatibility](#compatibility)
- [Examples](#examples)
- [Configuration file](#configuration-file)
- [Programmatic use](#programmatic-use)
- [License](#license)## Installation
```sh
npm install unified-consistency
```## API
This unified plugin stringifies the AST, and reports any differences from the input. You should
always specify this plugin last. It works with all unified ecosystems, including
[remark](https://github.com/remarkjs/remark) and [rehype](https://github.com/rehypejs/rehype).`processor.use(unifiedConsistency)`
### Options
This plugin has no options.
## Compatibility
This project is compatible with Node.js 18 or greater.
## Examples
### Configuration file
This plugin is best used in a
[configuration file](https://github.com/unifiedjs/unified-engine/blob/main/readme.md#config-files).
For example:```yaml
# .remarkrc.yaml
plugins:
- unified-consistency
```### Programmatic use
For example, the following script:
```js
import { remark } from 'remark'
import unifiedConsistency from 'unified-consistency'
import { reporter } from 'vfile-reporter'const processor = remark().use(unifiedConsistency)
const file = await processor.process('#Hello')
console.log(reporter([file]))
```Yields:
```
1:1-1:7 warning Replace `#Hello` with `\#Hello⏎` replace unified-consistency
⚠ 1 warning
```## License
[MIT](LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)