vite-plugin-norg

Published Sat Aug 02 2025

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 inline syntax highlights provided by shiki.

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',
      shikiOptions: {
        themes: {
          // Optional, github theme applied if none specified
          light: 'github-light',
          dark: 'github-dark',
        },
        // Optional, all langs enabled by default
        langs: ['javascript', 'typescript', 'python'],
      },
    })
  ]
});

Import a .norg file as a component!

<script>
import Document, { metadata } from './document.norg';
script>

<h1>{metadata.title}h1>
<Document />