# marked-sections

> Section wrapping for markdown parsing

Latest version **0.1.5** (published 2013-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install marked-sections
pnpm add marked-sections
yarn add marked-sections
bun add marked-sections
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2013-10-17 |
| First published | 2013-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.x |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+11 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jon Eisen |
| Maintainers | yanatan16 |

## Links

- npm: https://www.npmjs.com/package/marked-sections
- Repository: https://github.com/yanatan16/node-marked-sections
- Issues: https://github.com/yanatan16/node-marked-sections/issues
- npm.io page: https://npm.io/package/marked-sections

## Dependencies (2)

- [marked](https://npm.io/package/marked.md) ~0.2.9
- [underscore](https://npm.io/package/underscore.md) ~1.4.4

## Recent versions

- 0.1.5 (latest) — 2013-10-17
- 0.1.4 — 2013-07-03
- 0.1.3 — 2013-07-03
- 0.1.2 — 2013-06-30
- 0.1.1 — 2013-06-30
- 0.1.0 — 2013-06-30

## README

# marked-sections

A simple node.js package to use [marked](https://github.com/chjj/marked) to parse markdown and insert `<section>` tags around heading levels.

## Usage

```javascript
var mdsec = require('marked-sections');

mdsec.setOptions({
	levels: 2,
	hierarchy: false,
	deep: false,
	// marked options too
	gfm: true // see marked for full docs
});

html = mdsec.parse(markdownText);
html2 = mdsec.parse(markdownText, { hierarchy: true }); // change options

// Or you can do it manually
tree = mdsec.marked.lexer(markdownText);
sectree = mdsec.sectionalize(tree);
html = mdsec.marked.parser(sectree);
```

## Options

`marked-sections` takes two options above and beyond marked.

- `levels` refers to the header levels to wrap in sections. It should be the highest header level that should be wrapped in a section.
- `hierarchy` will make each level of header wrapped in a hierarchy of section tags. Defaults to false.
- `deep` will make a all hierarchy `levels` deep. Defaults to false. You probably don't want this on.
- `promoteHr` will promote HR's outside of the sections (level 0). Defaults to true.

For example, with hierarchy on:

	```
	# H1
	something
	## H2
	else
	# H1
	again
	```

	becomes

	```
	<section>
		<h1>H1</h1>
		<p>something</p>
		<section>
			<h2>H2</h2>
			<p>else</p>
		</section>
	</section>
	<section>
		<h1>H1</h1>
		<p>again</p>
	</section>
	```

## License

MIT Licensed 2013 Jon Eisen.

---
_Source: https://npm.io/package/marked-sections · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
