From e1c2ce176fb99360724df9f5d552626f11e0886b Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 3 Dec 2024 03:32:41 +0200 Subject: [PATCH] add find_syntax_by_name --- .../window/tab/item/page/content/text/gemini/reader/syntax.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs index dd266295..ec4b798d 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs @@ -33,6 +33,10 @@ impl Syntax { alt: Option<&String>, ) -> Result, Error> { if let Some(name) = alt { + if let Some(reference) = self.syntax_set.find_syntax_by_name(name) { + return self.syntect_buffer(source_code, source_tag, reference); + } + if let Some(reference) = self.syntax_set.find_syntax_by_extension(name) { return self.syntect_buffer(source_code, source_tag, reference); }