1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added default fallback for 'Text only' if the syntax is not supported.

This commit is contained in:
Uncled1023 2016-10-20 16:54:55 -07:00
parent 04c2e657ab
commit 14dee8455f

View File

@ -103,10 +103,11 @@ namespace Teknik.Areas.Paste.Controllers
// Transform content into HTML
if (Highlighter.Lexers.ToList().Exists(l => l.Name == model.Syntax))
{
Highlighter highlighter = new Highlighter();
// Add a space in front of the content due to bug with pygment (No idea why yet)
model.Content = highlighter.HighlightToHtml(" " + model.Content, model.Syntax, Config.PasteConfig.SyntaxVisualStyle, generateInlineStyles: true, fragment: true);
model.Syntax = "Text only";
}
Highlighter highlighter = new Highlighter();
// Add a space in front of the content due to bug with pygment (No idea why yet)
model.Content = highlighter.HighlightToHtml(" " + model.Content, model.Syntax, Config.PasteConfig.SyntaxVisualStyle, generateInlineStyles: true, fragment: true);
}
switch (type.ToLower())