Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pbox with all npm packages installed. Try it out:

var pbox = require("pbox")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pbox v2.0.0

Parser for concatenated Jekyll posts

pbox

Parser for concatenated Jekyll posts

Install

npm install pbox

Usage

var fs = require('fs')
var pbox = require('pbox')

var posts = fs.readFileSync('concat.md', 'utf-8')
var parsed = pbox.parse(posts)

Given the following input:

---
title: First post
---

Some text.

---
title: Second post
---

First section.

---

Second section.

This will parse into an array with this structure:

parsed = [
  {
    title: 'First post',
    content: ['\nSome text.\n']
  },
  {
    title: 'Second post',
    content: [
      '\nFirst section.\n',
      '\nSecond section.\n'
    ]
  }
]

License

Apache-2.0

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free