markdown-into-html

1.0.3 • Public • Published

markdown-into-html

Transform Markdown to HTML

Features

  • Transforms local files and files from URL
  • Uses markdown-it to convert from Markdown to HTML
  • Configurable, check list of options
  • Supports:
    • tables
    • HTML tags
    • links
    • emojis
    • task lists
    • footnotes
    • abbreviations
    • definition lists
    • <ins> tags
    • superscripts
    • subscripts
    • qoutes, styling and more

Installation

With yarn:

yarn add markdown-to-html

With npm:

npm install markdown-to-html

Usage

const markdownIntoHtml = require('markdown-into-html')
 
// Local file
const html_code = await markdownIntoHtml({
    path: './myMarkdownFile.md',
})
 
// URL source
const html_code = await markdownIntoHtml({
    url: 'https://raw.githubusercontent.com/mateuszjanusz/markdown-into-html/master/README.md',
})
 
// Using options:
const html_code = await markdownIntoHtml({
    path: './myMarkdownFile.md',
    options: {
        emoji: false, // disabling emojis
    },
})

Properties

Prop Type Description
path String The location of a file to transform
url String The URL source of a file to transform
options Object Rules and options, check the table below for available options

Options

By default all rules are enabled, but can be restricted by options.

Option Type Default Describe
html Boolean true Enable HTML tags in source
xhtmlOut Boolean true Close single tags with '/' (e.g. <br />)
breaks Boolean true Autoconvert '\n' in paragraphs to <br>
linkify Boolean true Autoconvert URL-like text to link
emoji Boolean true Enable Emoji syntax plugin and support emoticons shortcuts
typographer Boolean true Enable some language-neutral replacement and quotes beautification
langPrefix String language- CSS language prefix for fenced blocks
quotes String “”‘’ Double + single quotes replacement pairs, e.g. use «»„“ for Russian, “”‘’ for Chinese, „“‚‘ for German
taskLists Boolean true enable task/todo lists with items starting with [ ] or [x]

License

MIT

References

Package Sidebar

Install

npm i markdown-into-html

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

14.3 kB

Total Files

6

Last publish

Collaborators

  • mateuszjanusz