Socket
Socket
Sign inDemoInstall

markdownlint-rule-helpers

Package Overview
Dependencies
Maintainers
1
Versions
29
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


Version published
Maintainers
1
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 29 Aug 2024

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