1. metalsmith-md
Metalsmith plugin to transform markdown to html
metalsmith-md
Package: metalsmith-md
Created by: MoOx
Last modified: Sun, 19 Jun 2022 18:16:11 GMT
Version: 2.0.1
License: MIT
Downloads: 26
Repository: https://github.com/MoOx/metalsmith-md

Install

npm install metalsmith-md
yarn add metalsmith-md

metalsmith-md Travis Build Status

Metalsmith plugin to transform markdown to html

This plugin do not rename .md files to .html.
Please use metalsmith-rename for this.

Installation

 $ npm install metalsmith-md

Usage

 import Metalsmith from "metalsmith"
import md from "metalsmith-md"

import markdownIt from "markdown-it"
import hljs from "highlight.js"

new Metalsmith("./")
  .use(
    md({
      markdownIt: markdownIt({
        html: true,
        linkify: true,
        typographer: true,
        highlight: (code, lang) => {
          code = code.trim()

          // language is recognized by highlight.js
          if (lang && hljs.getLanguage(lang)) {
            try {
              return hljs.highlight(lang, code).value
            } catch (__) {}
          }

          // fallback to auto
          try {
            return hljs.highlightAuto(code).value
          } catch (__) {}

          // use external default escaping
          return ''
        },
      })
        //.use(...)
        //.use(...)
      ,
    })
  )
  .build(err => {if (err) {throw err}})

Options

pattern (default: /\.(txt|md|markdown)$/)

Allow you to specify which files should be parsed as md

markdownIt (default: markdownIt())

Allow you to specify your markdown-it instance.

Changelog

License

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code