@blunck/next-md
v1.0.0
Published
Import markdown files in your Next.js project
Downloads
1
Maintainers
Readme
Next.js + Markdown
Import markdown files in your Next.js project
Installation
npm install --save @blunck/next-md
Usage
Create a next.config.js
in your project
// next.config.js
const withMarkdown = require('@blunck/next-md')()
module.exports = withMarkdown()
You can now import parsed strings from .md
files
import foo from './foo.md'
export default () => <div dangerouslySetInnerHTML={{ __html: foo }} />
With markdown-loader
and html-loader
options
Optionally you can provide Marked.js and html-loader options
// next.config.js
const withMarkdown = require('@blunck/next-md')({
markdownLoaderOptions: {
gfm: true
},
htmlLoaderOptions: {
minimize: true,
conservativeCollapse: false
}
})
module.exports = withMarkdown()
Configuring Next.js
Optionally you can add your custom Next.js configuration as parameter
// next.config.js
const withMarkdown = require('@blunck/next-md')()
module.exports = withMarkdown({
webpack(config, options) {
return config
}
})