✨ added support for language, topic, and preset acquisition and detection functions
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/alecthomas/chroma/v2"
|
||||
"github.com/alecthomas/chroma/v2/lexers"
|
||||
"github.com/alecthomas/chroma/v2/styles"
|
||||
)
|
||||
|
||||
// LanguageDetector provides enhanced language detection capabilities
|
||||
@@ -168,6 +169,21 @@ func (ld *LanguageDetector) GetSupportedLanguages() []string {
|
||||
return lexers.Names(false) // false means don't include aliases
|
||||
}
|
||||
|
||||
// GetSupportedThemes returns a list of all supported themes
|
||||
func (ld *LanguageDetector) GetSupportedThemes() []string {
|
||||
var themes []string
|
||||
for name := range styles.Registry {
|
||||
themes = append(themes, name)
|
||||
}
|
||||
return themes
|
||||
}
|
||||
|
||||
// IsThemeSupported checks if a theme is supported
|
||||
func (ld *LanguageDetector) IsThemeSupported(theme string) bool {
|
||||
_, exists := styles.Registry[strings.ToLower(theme)]
|
||||
return exists
|
||||
}
|
||||
|
||||
// IsLanguageSupported checks if a language is supported
|
||||
func (ld *LanguageDetector) IsLanguageSupported(language string) bool {
|
||||
lexer := lexers.Get(language)
|
||||
|
Reference in New Issue
Block a user