Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexandremasy/markdown-to-pug
Markdown to PugJS converter
https://github.com/alexandremasy/markdown-to-pug
converter jade markdown pug pugjs
Last synced: 3 months ago
JSON representation
Markdown to PugJS converter
- Host: GitHub
- URL: https://github.com/alexandremasy/markdown-to-pug
- Owner: alexandremasy
- License: mit
- Created: 2017-11-06T07:31:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-14T03:05:12.000Z (over 1 year ago)
- Last Synced: 2024-09-27T08:40:48.128Z (3 months ago)
- Topics: converter, jade, markdown, pug, pugjs
- Language: JavaScript
- Homepage: https://alexandremasy.github.io/markdown-to-pug/
- Size: 125 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Markdown To [PugJS](https://pugjs.org/)
> Convert your Markdown to [PugJS](https://pugjs.org/)[![CircleCI](https://img.shields.io/circleci/project/github/RedSparr0w/node-csgo-parser.svg)](https://circleci.com/gh/alexandremasy/markdown-to-pug)
---## Why?
Sometimes you like the simplicity of markdown to just express whatever you want to say, but want to keep control on how it will look like. This is what it is about, get control over the output while adding simple ways to take advantage of the PugJS functionalities like mixins and layout.
## Install
**NodeJS**
```shell
npm --save install markdown-to-pug
```or
```shell
yarn add markdown-to-pug
```**Dependencies**
- [Markdown-It](https://github.com/markdown-it/markdown-it)
## API
#### constructor(options)
**Parameters**
| Property | Type | Description |
| -------- | ------ | --------------------------- |
| options | Object | An object with the options. |**Options**
| Option | Description |
| ------------- | ---------------------------------------- |
| `newline` | Newline definition. Default value: `\n` |
| `space` | Space definition. Default value: `\t` |
| `linkify` | Allow the use of Linkify by MarkdownIt. Default value: `true` |
| `typographer` | Allow the use of Typographer by MarkdownIt. Default value: `true` |
| `langPrefix` | Prefix to use to generate class on code block. Default value: `language-` |### .render(src)
**Parameters**
| Property | Type | Description |
| -------- | ------ | -------------------------------- |
| src | String | The Markdown you like to convert |**Return**
| Type | Description |
| ------ | ---------------- |
| String | The PugJS String |### .md
The instance of markdown-it. Use it to add plugin support.
## Example
```js
var md2pug = new (require('markdown-to-pug'))();var md = `![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")`;
var pug = md2pug.render(md);
```### Mixin support
With the folliwing PugJS mixin
```pugjs
mixin list
ul
li first
li second
li third
``````md
```
### Layout support
```md
# Title
```will yield to
```pugjs
extend layout.pugblock content
h1 Title
```