Skip to content
This repository has been archived by the owner on Apr 15, 2018. It is now read-only.

Latest commit

 

History

History
51 lines (36 loc) · 695 Bytes

README.md

File metadata and controls

51 lines (36 loc) · 695 Bytes

Parse two levels of headers from markdown file.

It transforms this markdown:

# Main header

First paragraph

## Subheader

Subheader text

# Second header

into

{
	sections: [
		{
			name: 'Main header',
			text: ['para', 'First paragraph'], // markdown-js JsonMl
			subsections: [
				{
					name: 'Subheader',
					text: ['para', 'Subheader text']
				}
			]
		},
		{
			name: 'Second header'
		}
	]
}

Content before first header is put into "preamble" section, with name set to null.

Run tests

To try it out run the tests:

> npm test

If you want to add more testcases to see what conditions I failed to consider, just add it to test/sections.coffee