JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 337963
  • Score
    100M100P100Q202881F
  • License MIT

Parse a comment marker in mdast

Package Exports

  • mdast-comment-marker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-comment-marker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mdast-comment-marker Build Status Coverage Status Chat

Parse an MDAST comment marker.

Installation

npm:

npm install mdast-comment-marker

Usage

var marker = require('mdast-comment-marker');

console.log(marker({
  type: 'html',
  value: '<!--foo-->'
}));

console.log(marker({
  type: 'html',
  value: '<!--foo bar baz=12.4 qux="test test" quux=\'false\'-->'
}));

console.log(marker({
  type: 'html',
  value: '<!doctype html>'
}));

Yields:

{ name: 'foo',
  attributes: '',
  parameters: {},
  node: { type: 'html', value: '<!--foo-->' } }
{ name: 'foo',
  attributes: 'bar baz=12.4 qux="test test" quux=\'false\'',
  parameters: { bar: true, baz: 12.4, qux: 'test test', quux: false },
  node:
   { type: 'html',
     value: '<!--foo bar baz=12.4 qux="test test" quux=\'false\'-->' } }
null

API

marker(node)

Parse a comment marker.

Parameters
  • node (Node) — Node to parse
Returns

Marker? — Information, when applicable.

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

Contribute

See contributing.md in syntax-tree/mdast for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer