mdgarden

Code Highlighting

1 min read#showcase#code

Syntax highlighting is powered by Shiki, which loads grammars dynamically — only the languages actually used in your content are bundled, but the full ~300-grammar catalog is available, not a hardcoded subset.

TypeScript

export function buildSlug(path: string): string {
  return path
    .toLowerCase()
    .replace(/\.md$/, '')
    .replace(/\s+/g, '-');
}

Python

def reading_time(words: int, wpm: int = 200) -> int:
    return max(1, round(words / wpm))

Bash

mdgarden build ./notes -o ./dist
mdgarden serve ./notes --port 4000

JSON

{
  "site": { "title": "My Notes" },
  "theme": { "name": "forest" }
}

Rust

fn slugify(input: &str) -> String {
    input.to_lowercase().replace(' ', "-")
}
Disabling highlighting

mdgarden config set features.syntaxHighlight false renders plain code blocks with no highlighting and no Shiki bundle at all.

Built with mdgarden