Skip to content

Commit d9dd69f

Browse files
committed
Add Djot syntax highlighting and fix base path for GitHub Pages
- Add custom Djot TextMate grammar from djot-intellij - Set base path to /djot-php/ for GitHub Pages deployment - Fix favicon path for subpath deployment
1 parent 36f6651 commit d9dd69f

2 files changed

Lines changed: 604 additions & 1 deletion

File tree

docs/.vitepress/config.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
import { defineConfig } from 'vitepress'
2+
import { readFileSync } from 'fs'
3+
import { dirname, resolve } from 'path'
4+
import { fileURLToPath } from 'url'
5+
6+
const __dirname = dirname(fileURLToPath(import.meta.url))
7+
8+
// Load custom Djot grammar for syntax highlighting
9+
const djotGrammar = JSON.parse(
10+
readFileSync(resolve(__dirname, 'grammars/djot.tmLanguage.json'), 'utf-8')
11+
)
212

313
export default defineConfig({
414
title: 'djot-php',
515
description: 'A PHP parser and converter for Djot markup language',
616

17+
base: '/djot-php/',
18+
719
head: [
8-
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
20+
['link', { rel: 'icon', href: '/djot-php/favicon.svg', type: 'image/svg+xml' }],
921
],
1022

23+
markdown: {
24+
languages: [
25+
{
26+
id: 'djot',
27+
scopeName: 'text.djot',
28+
...djotGrammar,
29+
aliases: ['dj'],
30+
},
31+
],
32+
},
33+
1134
themeConfig: {
1235
logo: '/logo.svg',
1336

0 commit comments

Comments
 (0)