Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@outcome-co/webpack-remark-loader

1.1.1 • Public • Published

webpack-remark-loader-js

ci-badge version-badge

A Webpack loader for Markdown using remark.

Installation

npm install @outcome-co/webpack-remark-loader

Usage

The loader outputs a javascript object that complies with either mdast or hast according to the options.

// webpack.config.js
 
{
    module: {
        rules: [{
            test: /\.md$/,
            use: [
                {
                    loader: '@outcome-co/webpack-remark-loader',
                    options: {
                        // Your options
                    }
                }
            ]
        }]
    }
}

Options

const options = {
    // Remove empty paragraphs in the Markdown file
    // using https://github.com/syntax-tree/mdast-squeeze-paragraphs
    // Default: true
    squeezeParagraphs: true,
 
    // Remove the position info from the AST
    // using https://github.com/syntax-tree/unist-util-remove-position
    // Default: true
    removePositions: true,
 
    // Convert from mdast to hast
    // using https://github.com/syntax-tree/mdast-util-to-hast
    //
    // Can take 3 values, or null.
    //
    // 'strip': converts the mdast to hast, removing any inline HTML
    // from the original Markdown.
    //
    // 'raw': converts the mdast to hast, converting inline HTML to 
    // hast nodes, without sanitization.
    //
    // 'sanitize': converts the mdast to hast, converting inline HTML to 
    // hast nodes, removing dangerous tags.
    //
    // Default: null
    hastConversion: null
}

API

Read the API docs here.

Development

Remember to run ./pre-commit.sh when you clone the repository.

Keywords

none

Install

npm i @outcome-co/webpack-remark-loader

DownloadsWeekly Downloads

53

Version

1.1.1

License

ISC

Unpacked Size

8.42 kB

Total Files

4

Last publish

Collaborators

  • avatar