From 55b466f3b42746f01946ff0aabd0466c072b6f68 Mon Sep 17 00:00:00 2001 From: Araozu Date: Wed, 5 Apr 2023 10:37:03 -0500 Subject: [PATCH] [Web] Highlight comments --- doc-generator/src/highlighter/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc-generator/src/highlighter/mod.rs b/doc-generator/src/highlighter/mod.rs index d37e9d4..b1d8d37 100644 --- a/doc-generator/src/highlighter/mod.rs +++ b/doc-generator/src/highlighter/mod.rs @@ -53,6 +53,17 @@ pub fn highlight(input: &String) -> String { output.replace_range(range, html.as_str()); } + TokenType::Comment => { + let start_pos = token.position; + let end_pos = token.get_end_position(); + + let range = (start_pos + offset)..(end_pos + offset); + let html = format!("{}", token.value); + + offset += 35; + + output.replace_range(range, html.as_str()); + } _ => {} } }