0.0.1 • Published 2 years ago

@sfdocs-internal/remark-lint-check-allowed-headers v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Remark lint Check Allowed Headers

What and Why

This package is a unified (remark) plugin, specifically a remark-lint rule. Lint rules check allowed markdown headings level. For example ; You can allow headings from h1-h4 in that case it will throw error for anything lower than h4 like h5 nd h6.

Configuration

headingLevel : Accepts value from 1 to 6. Default Value: 4.

Example: headingLevel: 4 means h1 to h4 are allowed.

Use

on the API

import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {remark} from 'remark'
import remarkLint from 'remark-lint'
import remarkLintCheckAllowedHeading from '@sfdocs-internal/remark-lint-check-allowed-headers'

main()

async function main() {
  const file = await remark()
    .use(remarkLint)
    // Use 'error' or 'warn' to make message fatal/non-fatal  
    .use(remarkLintCheckAllowedHeading, ['error', 4]) 
    .process(await read('example.md'))

  console.error(reporter(file))
}

How to set up

Install & build

yarn install && yarn build

Publish

yarn publish

Make sure to push your changes (version number & other changes) to git when publishing is complete.