lib/parse.js
function takeHeader(content, level, name) {
		var currLevel = sectionStack.length

		if (level > currLevel + 1) {
			throwSyntaxError('Unexpected header level ' + level + ' on section level ' + currLevel)
		} else if (level === 1) {
			throwSyntaxError('There can be only one header level 1, the first line of the file')
		}

		// Walk out
		sectionStack.length = level - 1

		// Create section
		section = {
			type: 'section',
			name: name || '',
			line: line,
			size: 1,
			content: content,
			level: level,
			children: []
		}
		sectionStack[sectionStack.length - 1].children.push(section)
		sectionStack.push(section)
	}
function takeHeader(content, level, name) {
		var currLevel = sectionStack.length

		if (level > currLevel + 1) {
			throwSyntaxError('Unexpected header level ' + level + ' on section level ' + currLevel)
		} else if (level === 1) {
			throwSyntaxError('There can be only one header level 1, the first line of the file')
		}

		// Walk out
		sectionStack.length = level - 1

		// Create section
		section = {
			type: 'section',
			name: name || '',
			line: line,
			size: 1,
			content: content,
			level: level,
			children: []
		}
		sectionStack[sectionStack.length - 1].children.push(section)
		sectionStack.push(section)
	}
function takeHeader ( content , level , name ) { var currLevel = sectionStack . length if ( level > currLevel + 1 ) { throwSyntaxError ( 'Unexpected header level ' + level + ' on section level ' + currLevel ) } else if ( level === 1 ) { throwSyntaxError ( 'There can be only one header level 1, the first line of the file' ) } // Walk out sectionStack . length = level - 1 // Create section section = { type : 'section' , name : name || '' , line : line , size : 1 , content : content , level : level , children : [ ] } sectionStack [ sectionStack . length - 1 ] . children . push ( section ) sectionStack . push ( section ) }
Process a new header, creating a new section
@param {string} content
@param {number} level
@param {?string} name
@private
Process a new header creating a new section