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

mdast-util-heading-style

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-heading-style

Utility to get the style of an mdast heading

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
81K
decreased by-42.71%
Maintainers
1
Weekly downloads
 
Created
Source

mdast-util-heading-style Build Status Coverage Status Chat

Get the style of an MDAST heading.

Installation

npm:

npm install mdast-util-heading-style

mdast-util-heading-style is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

var style = require('mdast-util-heading-style');
var remark = require('remark')();

style(remark.parse('# ATX').children[0]); // 'atx'
style(remark.parse('# ATX #\n').children[0]); // 'atx-closed'
style(remark.parse('ATX\n===').children[0]); // 'setext'

style(remark.parse('### ATX').children[0]); // null
style(remark.parse('### ATX').children[0], 'setext'); // 'setext'

API

style(node[, relative])

Get the heading style of a node.

Parameters
  • node (Node) — Node to parse;
  • relative (string, optional) — Style to use for ambiguous headings (atx-headings with a level of three or more could also be setext).
Returns

string ('atx', 'atx-closed', or 'setext') — When an ambiguous heading is found, either relative or null is returned.

Marker

A comment marker.

Properties
  • name (string) — Name of marker;
  • attributes (string) — Value after name;
  • parameters (Object) — Parsed attributes, tries to convert values to numbers and booleans when possible;
  • node (Node) — Reference to given node.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 13 Jun 2016

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