Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 1.02 KB

README.md

File metadata and controls

54 lines (35 loc) · 1.02 KB

markdown-split

Split a Markdown file (or any kind of plain-text file) in sections marked by the § character.

Installation

npm install markdown-split

Usage

let split = require('markdown-split');

let content = `
§ First section

Content of the first section.

§ Second section

Content of the second section.
`;

let sections = split(content);

console.log(sections);

This should produce the following output:

[
	{
		name: 'First section',
		content: 'Content of the first section'
	},
	{
		name: 'Second section',
		content: 'Content of the second section'
	}
]

Notes

If the § character is not followed by a section name, the name property of that section will not be present in the output.

How to produce the § character

If you don't already have it on your keyboard, this Wikipedia page lists the key combinations to produce the § character on a variety of keyboards.