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

mdast-comment-marker

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-comment-marker

Parse a comment marker in mdast

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
132K
decreased by-32.62%
Maintainers
1
Weekly downloads
 
Created
Source

mdast-comment-marker Build Status Coverage Status Chat

Parse an MDAST comment marker.

Installation

npm:

npm install mdast-comment-marker

mdast-comment-marker is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

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

A simple marker:

var result = marker({
    'type': 'html',
    'value': '<!--foo-->'
});

Yields:

{
  "name": "foo",
  "attributes": "",
  "parameters": {},
  "node": {
    "type": "html",
    "value": "<!--foo-->"
  }
}

Parameters:

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

Yields:

{
  "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'-->"
  }
}

Non-markers:

result = marker({
    'type': 'html',
    'value': '<!doctype html>'
});

Yields:

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.

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