Add basic syntax highlighting support with syntect. Closes #5.

This commit is contained in:
Quin 2025-07-05 22:28:16 -06:00
parent 3897b8dd30
commit cd5c12ff21
3 changed files with 89 additions and 6 deletions

View file

@ -1,4 +1,4 @@
use super::render::{execute_lua, expand_template, process_markdown};
use super::render::{execute_lua, expand_template, process_markdown, process_syntax_highlighting};
use anyhow::Result;
use kuchikiki::traits::TendrilSink;
use std::{
@ -16,6 +16,7 @@ pub fn serve_content(request_uri: &str) -> Result<String> {
let doc = kuchikiki::parse_html().one(page_string);
let full_doc = expand_template(doc, &components, None)?;
let markdown_doc = process_markdown(full_doc)?;
let executed_doc = execute_lua(markdown_doc)?;
let highlighted_doc = process_syntax_highlighting(markdown_doc)?;
let executed_doc = execute_lua(highlighted_doc)?;
Ok(executed_doc.to_string())
}