editor: add plain language with no grammar
This commit is contained in:
@@ -26,6 +26,7 @@ struct Highlighter {
|
||||
/// A language source can highlight as.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Language {
|
||||
Plain,
|
||||
Rust,
|
||||
JavaScript,
|
||||
TypeScript,
|
||||
@@ -163,6 +164,7 @@ fn grammar_for(language: Language) -> Option<(tree_sitter::Language, &'static st
|
||||
Language::TypeScript => typescript_grammar(),
|
||||
Language::JavaScript => javascript_grammar(),
|
||||
Language::Python => python_grammar(),
|
||||
Language::Plain => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,10 @@ impl Role {
|
||||
|
||||
#[cfg(feature = "markdown")]
|
||||
impl Language {
|
||||
/// Maps a fence info string to a bundled grammar.
|
||||
/// Maps a fence info string to a language.
|
||||
pub(crate) fn from_fence_info(info: &str) -> Option<Language> {
|
||||
match info.to_ascii_lowercase().as_str() {
|
||||
"plain" | "text" | "txt" => Some(Language::Plain),
|
||||
"rust" | "rs" => Some(Language::Rust),
|
||||
"typescript" | "ts" => Some(Language::TypeScript),
|
||||
"javascript" | "js" => Some(Language::JavaScript),
|
||||
|
||||
Reference in New Issue
Block a user