Socket
Socket
Sign inDemoInstall

sections

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sections

Manipulate sections in a string of markdown.


Version published
Maintainers
1
Install size
9.71 kB
Created

Readme

Source

sections NPM version Build Status

Manipulate sections in a string of markdown.

Install

Install with npm:

$ npm i sections --save

Usage

Usage

Usage

Usage

This is meant to be fast and opinionated, and only works with ATX headings.

var sections = require('sections');

API

.parse

Parses sections in a string of markdown and returns an object with two properties:

  • sections: an array of markdown "sections", delimited by ATX headings,
  • result: the cumulative result of whatever is returned by the (optional) function that is passed as the second argument.

{%= doc('examples/parse.md') %}

Params

  • string {String}
  • fn {Function}
  • returns {Object}

.format

Format sections. By default, if no filter function is passed, this:

  • filters out empty sections
  • fixes whitespace between sections

Params

  • str {String}: Markdown string
  • fn {Function}: optional filter function
  • returns {String}

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb, v0.9.0, on February 06, 2016.

Keywords

FAQs

Last updated on 15 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc