An open API service indexing awesome lists of open source software.

https://github.com/hygull/node-markdown

An npm package which allows to generate a markdown file using a pure object oriented oriented approach which can be used to create documentation (README.md) for projects.
https://github.com/hygull/node-markdown

documentation documentation-generator file-creation html5 markdown node-module

Last synced: about 2 months ago
JSON representation

An npm package which allows to generate a markdown file using a pure object oriented oriented approach which can be used to create documentation (README.md) for projects.

Awesome Lists containing this project

README

          

node-markdown

An npm package which allows to generate a markdown file using a pure object oriented oriented approach which can be used to create documentation (README.md) for projects.

> You can also visit [https://hygull.github.io/node-markdown/](https://hygull.github.io/node-markdown/) and read the beautiful documentation.

Installation

| Type | Command |
| --- | --- |
| Locally | `npm install node-markdown` |
| Globally | `npm install node-markdown -g` |

What is markdown and who developed it?

+ Markdown is a lightweight markup language with plain text formatting syntax. Its design allows it to be converted to many output formats, but the original tool by the same name only supports HTML.

+ **Developed by** » **John Gruber** (in collaboration with **Aaron Swartz** on the syntax)

Examples

* Get/set visit links

* Get/set markdown code to display image

> Please look into the below well commented examples to have a quick taste.

Get/set visit links

```javascript
const {Markdown} = require("node-markdown");
const md = new Markdown();

/* Get anchor link (to visit)
==========================

[Visit w3schools](https://www.w3schools.com)
*/
console.log(md.getTextLink("Visit w3schools", "https://www.w3schools.com"));

/* Set anchor link (to visit)
==========================

{
"elements": [
"[Visit w3schools](https://www.w3schools.com)"
]
}
*/
md.setTextLink('Visit w3schools', 'https://www.w3schools.com');
console.log(JSON.stringify(md.markdown, null, 4));

```

Get/set markdown code to display image

```javascript
const {Markdown} = require("node-markdown");
const md = new Markdown();

/* Get image link (to display)
===========================

![Graph icon]{https://image.flaticon.com/icons/svg/123/123407.svg}
*/
console.log(md.getImageLink("Graph icon", "https://image.flaticon.com/icons/svg/123/123407.svg"));

/* Set image link (to display)
===========================

{
"elements": [
"![Graph icon]{https://image.flaticon.com/icons/svg/123/123407.svg}"
]
}
*/
md.setImageLink('Graph icon', 'https://image.flaticon.com/icons/svg/123/123407.svg');
console.log(JSON.stringify(md.markdown, null, 4));

```