项目作者: mateuszjanusz

项目描述 :
Transform Markdown files to HTML
高级语言: JavaScript
项目地址: git://github.com/mateuszjanusz/markdown-into-html.git
创建时间: 2018-10-04T16:31:44Z
项目社区:https://github.com/mateuszjanusz/markdown-into-html

开源协议:

下载


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:

  1. yarn add markdown-to-html

With npm:

  1. npm install markdown-to-html

Usage

  1. const markdownIntoHtml = require('markdown-into-html')
  2. // Local file
  3. const html_code = await markdownIntoHtml({
  4. path: './myMarkdownFile.md',
  5. })
  6. // URL source
  7. const html_code = await markdownIntoHtml({
  8. url: 'https://raw.githubusercontent.com/mateuszjanusz/markdown-into-html/master/README.md',
  9. })
  10. // Using options:
  11. const html_code = await markdownIntoHtml({
  12. path: './myMarkdownFile.md',
  13. options: {
  14. emoji: false, // disabling emojis
  15. },
  16. })

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