3.2.2 • Published 10 years ago

yaml-markdown-loader v3.2.2

Weekly downloads
1
License
MIT
Repository
-
Last release
10 years ago

Build Status

Yaml and Markdown webpack loader.

Why

Sometimes you want to generate a complete html page out of your markdown file, but markdown is just not enough for an html page, you also need a bunch of meta information about your page (like title and etc.), that you want to control somehow. For that purpose you are know able to do it like this:

---
head:
  title: Test title
  meta-description: Page to get a test information
---
# Test title

 your awesome markdown content

The area between two --- is nothing else as a Yaml and everything below is your actual Markdown.

An output that will be generated is equal to a following JSON object:

{ meta:
   { head:
      { title: 'Test title',
        'meta-description': 'Page to get a test information'
      }
   },
  html: '<h1 id="test-title">Test title</h1>\n<p> your awesome markdown content</p>\n'
}

Configuration

Your webpack.config.js can look like this:

entry: __dirname + '/entry.js',
output: {
  path: __dirname,
  filename: 'bundle.js'
},
module: {
  loaders: [
    {test:/\.md$/, loader:'yaml-markdown'}
  ]
}

Code Render Extensions

Sometime you want to introduce new languages for markdown code blocks, to achive this you have to provide filename of a custom renderer in loader query

  {test: /\.md$/, loader: 'json!yaml-markdown?codeRenderer=customLangExtension'}

and implement a file in a following location: <your_project_folder>/yaml-markdown-loader-extentions/<codeRenderer>.js

The implementation of this file have to provide a function that takes 3 arguments:

  • code
  • lang
  • callback (optional)
export default  (code, lang, escaped) => {
  return <markup>you need</markup>
}

To Do

  • enable markdown custom options
3.2.2

10 years ago

3.2.1

10 years ago

3.1.0

10 years ago

3.0.1

10 years ago

3.0.0

10 years ago

2.2.0

10 years ago

2.1.0

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.0

10 years ago