markdownattrs-loader for webpack
npm install markdownattrs-loadermarkdownattrs-loader
===============

markdownattrs-loader for webpack using markdown-it-attrs based on markdown-it that allows you to set classes, identifiers and attributes to your markdown.
Add classes, identifiers and attributes to your markdown with {.class #identifier attr=value attr2="spaced value"} curly brackets, similar to pandoc's header attributes.

``bash`
npm install markdownattrs-loader
`javascript`
var html = require("html!markdownattrs!./file.md");
Since marked's output is HTML, it's best served in conjunction with the html-loader.
`javascript`
{
module: {
loaders: [
{ test: /\.md$/, loader: "html!markdownattrs" },
]
}
}
markdown-it-options are passed via query params:
`javascript`
{
module: {
loaders: {
{ test: /\.md$/, loader: "html!markdownattrs?html=true" },
]
}
}
Simply set the markdownattrsLoader-option on your webpack options. You can also change the options' key"markdownattrs?config=markdownattrsLoaderCustomConfig"
with a query parameter: .
`javascript
// webpack.config.js
module.exports = {
...
markdownattrsLoaderCustomConfig: {
html: true,
...
}
};
`
`javascript
{
//markdown-it defaults:
//------------------------------------------------
html: false, // Enable HTML tags in source
xhtmlOut: false, // Use '/' to close single tags (
).
// This is only for full CommonMark compatibility.
breaks: false, // Convert '\n' in paragraphs into
langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be
// useful for external highlighters.
linkify: false, // Autoconvert URL-like text to links
// Enable some language-neutral replacement + quotes beautification
typographer: false,
// Double + single quotes replacement pairs, when typographer enabled,
// and smartquotes on. Could be either a String or an Array.
//
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
quotes: '“”‘’',
// Highlighter function. Should return escaped HTML,
// or '' if the source string is not changed and should be escaped externaly.
// If result starts with
$3
#### via query parameter:
`javascript
{
module: {
loaders: {
{ test: /\.md$/, loader: "html!markdownattrs?use[]=markdown-it-sup,use[]=markdown-it-sub" },
]
}
}
`#### or
markdownattrsLoader-option:`javascript
// webpack.config.jsvar markdownSup = require('markdown-it-sup');
var markdownSub = require('markdown-it-sub');
module.exports = {
...
markdownattrsLoader: {
use: [markdownSup, markdownSub], // It's always an array
...
}
};
``Copyright (c) 2016 Vasily Pikulev.
This is free software, and may be redistributed under the terms specified in the LICENSE file