Import markdown files with esbuild
, using marked.
yarn add -D esbuild-plugin-markdown
or
npm i -D esbuild-plugin-markdown
Add it to your esbuild plugins list:
const esbuild = require("esbuild");
const { markdownPlugin } = require("esbuild-plugin-markdown");
esbuild.build({
...
plugins: [
markdownPlugin()
]
...
});
import markdownFile from "../assets/example.md";
// markdownFile: {
// html: parsed markdown (with "marked")
// raw: raw markdown file
// filename: imported file's absolute path
// }
You can add your own custom configuration of options to esbuild-plugin-markdown
:
markdownPlugin({
// options
});
Custom marked options.