Socket
Socket
Sign inDemoInstall

bun-plugin-markdoc

Package Overview
Dependencies
10
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bun-plugin-markdoc

[Markdoc](https://markdoc.io/) plugin for Bun.


Version published
Maintainers
1
Install size
153 kB
Created

Readme

Source

bun-plugin-markdoc

Markdoc plugin for Bun.

Installation

bun add @markdoc/markdoc bun-plugin-markdoc

Bundler usage

import markdoc from 'bun-plugin-markdoc'

Bun.build({
  // other config
  plugins: [
    markdoc()
  ],
})

In your sources you can now import markdown files:

---
title: What is Markdoc?
---

# {% $markdoc.frontmatter.title %} {% #overview %}

Markdoc is a Markdown-based syntax and toolchain for creating custom documentation sites. Stripe created Markdoc to power [our public docs](http://stripe.com/docs).

{% callout type="check" %}
Markdoc is open-source—check out its [source](http://github.com/markdoc/markdoc) to see how it works.
{% /callout %}
import overview from './overview.md'

console.log(overview) // Tree node

or import as html string:

import overview from './overview.md?html'

console.log(overview) // html string

The contents of the imported markdown file will be inlined into your bundle.

Runtime usage

To use as a runtime plugin, create a file that registers the plugin:

// markdoc.ts
import markdoc from 'bun-plugin-markdoc'

Bun.plugin(markdoc({}));

Then preload it in your bunfig.toml:

preload = ['./markdoc.ts']

Configuration

The plugin accepts an optional Markdoc.transform config:

import markdoc from 'bun-plugin-markdoc'

Bun.plugin(markdoc({
  nodes: {},
  tags: {},
}))

License

MIT

Keywords

FAQs

Last updated on 21 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc