You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

mdast-util-inject

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-inject

Inject some markdown into some other markdown, keeping heading structure intact.


Version published
Weekly downloads
81K
increased by6.57%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Circle CI js-standard-style

An mdast utility to inject some markdown into some other markdown, keeping heading structure intact.

Install

npm install mdast-util-inject

Usage

inject

Inject some markdown into some other markdown at a desired heading. Heading levels in the source markdown are adjusted to match the target document based on the target heading's level. targetAst is modified in place

Parameters

  • targetHeadingText string The heading to look for in the target ast
  • targetAst object The target markdown document, as an mdast
  • toInjectAst object The source markdown to be injected into the target, also as an mdast.

Examples

var mdast = require('mdast')
var inject = require('mdast-util-inject')

var target = mdast.parse('# A document\n## Section1\nBlah\n## Section2\nBlargh')
var newStuff = mdast.parse('# Some other document\nwith some content')
inject('Section1', target, newStuff)

console.log(mdast.stringify(target))
// outputs:
// # A document
//
// ## Section1
//
// ### Some other document
//
// with some content
//
// ## Section2
//
// Blargh

Returns boolean whether the specified section was found and content inserted

Keywords

FAQs

Package last updated on 14 Dec 2015

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc