Merge pull request #386 from n-peugnet/lexer-fallback
Fallback to "plaintext" lexer in codeblock parser
This commit is contained in:
commit
ae10e8ebd7
@ -292,7 +292,7 @@ func tokenToTextEntity(style *chroma.Style, token *chroma.Token) *TextEntity {
|
|||||||
func (parser *htmlParser) syntaxHighlight(text, language string) Entity {
|
func (parser *htmlParser) syntaxHighlight(text, language string) Entity {
|
||||||
lexer := lexers.Get(strings.ToLower(language))
|
lexer := lexers.Get(strings.ToLower(language))
|
||||||
if lexer == nil {
|
if lexer == nil {
|
||||||
return nil
|
lexer = lexers.Get("plaintext")
|
||||||
}
|
}
|
||||||
iter, err := lexer.Tokenise(nil, text)
|
iter, err := lexer.Tokenise(nil, text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user