https://github.com/eldoy/tomarkup
Convert strings to markup
https://github.com/eldoy/tomarkup
Last synced: 4 months ago
JSON representation
Convert strings to markup
- Host: GitHub
- URL: https://github.com/eldoy/tomarkup
- Owner: eldoy
- License: mit
- Created: 2021-01-09T23:54:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-12T22:50:41.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T05:06:16.691Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 260 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tomarkup
This library makes it easy to convert markdown to html.
Features:
* Github flavored Markdown to HTML, raw text and files
* Converts youtube and vimeo video links to iframes
* Mustache support for template data
* Automatic highlight code syntax
* Emoji support
* "Front matter" support
Based on [marked.js](https://github.com/markedjs/marked), [mustache](https://github.com/janl/mustache.js), [node-emoji](https://github.com/omnidan/node-emoji) and [prismjs.](https://github.com/PrismJS/prism)
### Install
```bash
npm i tomarkup
```
### Usage
```js
const tomarkup = require('tomarkup')
// marked.js options
const formatter = tomarkup({ highlight: false })
// Convert file
const formatter = tomarkup({ file: true })
const { html } = formatter('file.md')
// Convert file with params
const formatter = tomarkup({ file: true })
const { html } = formatter('file.md', { hello: 'waveorb' })
// Convert markdown content with params
const { html } = formatter('# Hello', { hello: 'waveorb' })
// Convert html with params
const { html } = formatter('file.html', { hello: 'waveorb' })
// Extract HTML, data and markdown
const { html, data, md } = formatter('file.md')
```
MIT Licensed. Enjoy!