Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.16 KB

README.md

File metadata and controls

40 lines (26 loc) · 1.16 KB

esbuild-markdoc-plugin

esbuild plugin for markdown files using Markdoc.

How to use the plugin

The goal of this plugin is to convert .md files into the content object expected by Markdoc render functions.

  1. Add to your esbuild plugins array.
import markdocPlugin from "esbuild-markdoc-plugin";

config = {
  ...,
  plugins: [
    markdocPlugin(),
  ],
  ...,
}
  1. All files with .md extention will be parsed with Markdoc, and transformed into the content json object for Markdoc renderers.
import Markdoc from '@markdoc/markdoc';
import content from './my-markdown.md';

const html = Markdoc.renderers.html(content);

Custom Config

You can pass a custom config object to markdocPlugin(config).

Contributing

I wanted this for my own project so I built this plugin. I figured other people might want to use it as well so here it is.

Please file issues or open PRs and I will try to address them quickly.