Skip to content

Webpack loader that parses markdown files and converts them to a useful javascript object.

Notifications You must be signed in to change notification settings

Theoton/demo-md-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

demo-md-loader

Webpack loader that parses markdown files and converts them to a useful javascript object.

Usage

$ yarn add demo-md-loader

webpack.config.js

module: {
  loaders: [
    {
      test: /\.md$/,
      use: [
        {
          loader: require.resolve('demo-md-loader'),
        }
      ]
    }
  ]
}

demo.js

export default { demo: 0 }

demo.md

---
title: demo
imports: 
  - './demo.js'
---

## demo
this is body

output.js

import demo from 'demo.md';

console.log(demo);
/* 
* demo: {
*   attributes: {
*     title: "demo",
*     imports: ["./demo.js"]
*   },
*   body: "## demo  this is body",
*   codes: ["export default { demo: 0 }"]
*   modules: [{ demo: 0 }]
* }
*/

About

Webpack loader that parses markdown files and converts them to a useful javascript object.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published