1.0.3 • Published 5 years ago

markdown-into-html v1.0.3

Weekly downloads
86
License
MIT
Repository
github
Last release
5 years ago

markdown-into-html

npm.io npm.io

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

PropTypeDescription
pathStringThe location of a file to transform
urlStringThe URL source of a file to transform
optionsObjectRules and options, check the table below for available options

Options

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

OptionTypeDefaultDescribe
htmlBooleantrueEnable HTML tags in source
xhtmlOutBooleantrueClose single tags with '/' (e.g. <br />)
breaksBooleantrueAutoconvert '\n' in paragraphs to <br>
linkifyBooleantrueAutoconvert URL-like text to link
emojiBooleantrueEnable Emoji syntax plugin and support emoticons shortcuts
typographerBooleantrueEnable some language-neutral replacement and quotes beautification
langPrefixStringlanguage-CSS language prefix for fenced blocks
quotesString“”‘’Double + single quotes replacement pairs, e.g. use «»„“ for Russian, “”‘’ for Chinese, „“‚‘ for German
taskListsBooleantrueenable task/todo lists with items starting with or x

License

MIT

References