From d828d526ca38eb971889ca0e4a5b59f60a8368fe Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Fri, 20 Jan 2023 20:11:08 +0100 Subject: [PATCH] Add plain text syntax alias to text Closes #1633 --- CHANGELOG.md | 1 + components/config/examples/generate_sublime.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e02896fa..25a9ae50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This will error if 2 values are set - Add sorting by slug for pages - Enable locale date formatting for the Tera `date` filter - Cachebust fingerprint is now only 20 chars long +- Add `text` alias for plain text highlighting (before, only `txt` was used) ## 0.16.1 (2022-08-14) diff --git a/components/config/examples/generate_sublime.rs b/components/config/examples/generate_sublime.rs index 06a0ba0f..28336694 100644 --- a/components/config/examples/generate_sublime.rs +++ b/components/config/examples/generate_sublime.rs @@ -5,7 +5,7 @@ use libs::syntect::dumps::*; use libs::syntect::highlighting::ThemeSet; -use libs::syntect::parsing::SyntaxSetBuilder; +use libs::syntect::parsing::{SyntaxDefinition, SyntaxSetBuilder}; use std::collections::HashMap; use std::collections::HashSet; use std::env; @@ -27,6 +27,12 @@ fn main() { (Some(ref cmd), Some(ref package_dir), Some(ref packpath_newlines)) if cmd == "synpack" => { let mut builder = SyntaxSetBuilder::new(); builder.add_plain_text_syntax(); + // We add an alias to txt for text + // https://github.com/getzola/zola/issues/1633 + let s = "---\nname: Plain Text\nfile_extensions: [text]\nscope: text.plain\ncontexts: \ + {main: []}"; + let syn = SyntaxDefinition::load_from_str(s, false, None).unwrap(); + builder.add(syn); let base_path = Path::new(&package_dir).to_path_buf(); // First the official Sublime packages