In July I released my first vite plugin! vite-plugin-norg provides support for .norg files in vite projects, using rust-norg to parse documents into ASTs which are then transformed into HTML for serving.
Features
The following output formats are supported:
- React
- Svelte
- HTML
Documents may contain headings, paragraphs, lists, links, images, and code blocks. Code blocks come with tree-sitter highlights from arborium.
Try it out
The plugin requires very minimal setup:
1. Install the dependency
npm install --save-dev vite-plugin-norg
2. Extend your vite configuration
import { defineConfig } from 'vite' ; import { norgPlugin } from 'vite-plugin-norg' ; export default defineConfig ({ plugins : [ norgPlugin ({ mode : 'html' , arboriumConfig : { themes : { light : 'Github Light' , dark : 'Github Dark' } } }) ] });
Import a .norg file as a component!
< script > import Document , { metadata } from './document.norg' ; </ script > < h1 >{ metadata . title }</ h1 > < Document />