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

markdownlint-rule-helpers

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdownlint-rule-helpers

A collection of markdownlint helper functions for custom rules

  • 0.17.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
240K
increased by7.71%
Maintainers
1
Weekly downloads
 
Created

What is markdownlint-rule-helpers?

The markdownlint-rule-helpers package provides utility functions to assist in writing custom rules for markdownlint, a popular Markdown linter. These helpers simplify common tasks such as parsing Markdown content, managing tokens, and handling rule options.

What are markdownlint-rule-helpers's main functionalities?

parseMarkdown

The parseMarkdown function takes a string of Markdown content and returns a parsed representation of it, which can be used for further analysis or rule enforcement.

const { parseMarkdown } = require('markdownlint-rule-helpers');
const markdownContent = '# Title\n\nSome content';
const parsed = parseMarkdown(markdownContent);
console.log(parsed);

getLineMetadata

The getLineMetadata function processes an array of lines from a Markdown document and returns metadata about each line, such as its length and whether it is blank. This is useful for rules that need to analyze line-by-line content.

const { getLineMetadata } = require('markdownlint-rule-helpers');
const lines = ['# Title', '', 'Some content'];
const metadata = getLineMetadata(lines);
console.log(metadata);

addError

The addError function helps in adding error messages to a list of errors, specifying the line number, error message, and optional context. This is essential for reporting issues found by custom rules.

const { addError } = require('markdownlint-rule-helpers');
const errors = [];
addError(errors, 1, 'Error message', 'Context');
console.log(errors);

Other packages similar to markdownlint-rule-helpers

Keywords

FAQs

Package last updated on 22 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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