# @presenta/md2pjson

> ![](https://img.shields.io/npm/v/@presenta/md2pjson)

Latest version **1.0.24** (published 2021-03-17) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @presenta/md2pjson
pnpm add @presenta/md2pjson
yarn add @presenta/md2pjson
bun add @presenta/md2pjson
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.24 |
| Published | 2021-03-17 |
| First published | 2020-12-02 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 241.8 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | abusedmedia |

## Links

- npm: https://www.npmjs.com/package/@presenta/md2pjson
- npm.io page: https://npm.io/package/@presenta/md2pjson

## Dependencies (5)

- [md5](https://npm.io/package/md5.md) ^2.3.0
- [yaml](https://npm.io/package/yaml.md) ^1.10.0
- [marked](https://npm.io/package/marked.md) ^2.0.1
- [node-emoji](https://npm.io/package/node-emoji.md) ^1.10.0
- [front-matter](https://npm.io/package/front-matter.md) ^4.0.2

## Recent versions

- 1.0.24 (latest) — 2021-03-17
- 1.0.23 — 2021-03-17
- 1.0.22 — 2021-03-17
- 1.0.21 — 2021-03-17
- 1.0.20 — 2021-03-05
- 1.0.19 — 2021-02-21
- 1.0.18 — 2021-01-07
- 1.0.17 — 2021-01-07
- 1.0.16 — 2021-01-04
- 1.0.15 — 2020-12-30
- 1.0.14 — 2020-12-21
- 1.0.13 — 2020-12-20
- 1.0.12 — 2020-12-14
- 1.0.11 — 2020-12-14
- 1.0.10 — 2020-12-14
- … 9 more at https://npm.io/package/@presenta/md2pjson/versions

## README

# Markdown to PRESENTA JSON

![](https://img.shields.io/npm/v/@presenta/md2pjson)

This library converts from `markdown` to an opinionated [PRESENTA](https://github.com/presenta-software/presenta-lib) config object.

A quick example [here](https://codepen.io/abusedmedia/pen/WNGwMrR).

## Usage

Parse a raw markdown string to get a JSON object:

```js
md2pjson.parse(md)
```

Get the index of the scene passing the line number of the raw markdown:

```js
const index = md2pjson.findIndex(res, 7)
```


Get the lines range in the raw markdown passing the index of the scene:

```js
const range = md2pjson.findRange(res, 1)
```


Change the separators string used for both the scenes and fragments, before parsing:

```js
md2pjson.setting.sceneSeparator = '---'
md2pjson.setting.fragmentSeparator = '–'
```

The library parses the HTML comments as scene and block properties:

```markdown
<!--
textVar: section
colorBack: red
-->

# hello 

```

Also, you can create blocks using this notation:

```markdown
# hello

```youtube
url: YTcodeID
```  

```

The above chunk creates a scene with two blocks, the first one is a `text` block, the last one a `youtube` block.

This library understands a [subset](https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json) of [emoji shortcodes](https://emojipedia.org/shortcodes/), such as:

```markdown
# Hello! :heart:
```

## Development

Run the watcher:

    npm start

and the local webserver

    npm run test

## Licence

This plugin is released under the [3-Clause BSD license](LICENSE).

Copyright © 2020 Fabio Franchino, [https://fabiofranchino.com](https://fabiofranchino.com)

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