Skip to content
This repository was archived by the owner on Dec 6, 2019. It is now read-only.

Repository files navigation

Markdown builder for Node

Build Statusnpm bundle size (minified + gzip)npm

Official README builder for the 30-seconds projects.

Usage

npm install --save markdown-builder

Using markdown-builder is quite easy:

constmarkdown=require('markdown-builder');const{ headers }=markdown;headers.hX(3,'3rd Header')// ### 3rd Header

Example

Check out 30-seconds-of-code's READMEs, they are automatically generated using markdown-builder

API

Headers

Use the h1,h2,h3,h4,h5,h6 or hX to generate a markdown header. Calling hX with a level above 6 returns a h6 Header.

constmarkdown=require('markdown-builder')const{ headers }=markdownheaders.h1('1st Header')// # 1st Headerheaders.h2('2nd Header')// ## 2nd Headerheaders.h3('3rd Header')// ### 3rd Headerheaders.hX(5,'5th Header using hX')// ##### 5th Header using hX

Emphasis

constmarkdown=require('markdown-builder')const{ emphasis }=markdownemphasis.b('bold text')emphasis.i('italic text')emphasis.s('strikethrough text')

Lists

constmarkdown=require('markdown-builder')const{ lists }=markdownleta=['Item 1','Item 2']// ordered listlists.ol(a)// 1. Item 1// 2. Item 2lists.ol(a,(item)=>item.toUpperCase())// use callbacks to alter each item// 1. ITEM 1// 2. ITEM 2// unordered Listlists.ul(a)lists.ul(a,(item)=>item.toUpperCase())

Miscellaneous

constmarkdown=require('markdown-builder')const{ misc }=markdown// Imagesletalt='image of lights',url='https://www.w3schools.com/w3css/img_lights.jpg',title='lights'misc.image(alt,url)misc.image(alt,url,title)// Collapsible summary/details blockmisc.collapsible('Summary','content');// Github Anchormisc.anchor('A header with /*() special-characters!');// #a-header-with--special-characters// Linkmisc.link('Github','https://github.com/flxwu')// horizontal rulemisc.hr()

Collapsible:

Summary Content

A header with /*() special-characters!

About

1kb Markdown builder for Node.js

Topics

Resources

Stars

91 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages