Browse Source

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

tags/2.0.6
Teknikode 3 years ago
parent
commit
14dee8455f
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      Teknik/Areas/Paste/Controllers/PasteController.cs

+ 4
- 3
Teknik/Areas/Paste/Controllers/PasteController.cs 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())

Loading…
Cancel
Save