presenta-software / md2pjson

A javascript library that converts from markdown to an opinionated PRESENTA config object.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markdown to PRESENTA JSON

This library converts from markdown to an opinionated PRESENTA config object.

A quick example here.

Usage

Parse a raw markdown string to get a JSON object:

md2pjson.parse(md)

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

const index = md2pjson.findIndex(res, 7)

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

const range = md2pjson.findRange(res, 1)

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

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

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

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

# hello 

Also, you can create blocks using this notation:

# 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 of emoji shortcodes, such as:

# 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.

Copyright © 2020 Fabio Franchino, https://fabiofranchino.com

About

A javascript library that converts from markdown to an opinionated PRESENTA config object.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:JavaScript 90.5%Language:HTML 9.5%