Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomasjo/highlight
A relatively simple and extensible syntax highlighter written in C#
https://github.com/thomasjo/highlight
c-sharp dotnet extensible syntax-highlighting
Last synced: 1 day ago
JSON representation
A relatively simple and extensible syntax highlighter written in C#
- Host: GitHub
- URL: https://github.com/thomasjo/highlight
- Owner: thomasjo
- License: mit
- Created: 2011-03-23T11:34:50.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2024-01-10T16:21:28.000Z (12 months ago)
- Last Synced: 2024-12-16T20:22:54.895Z (9 days ago)
- Topics: c-sharp, dotnet, extensible, syntax-highlighting
- Language: C#
- Homepage:
- Size: 490 KB
- Stars: 89
- Watchers: 8
- Forks: 28
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Highlight
A relatively simple and extensible syntax highlighter written in C#.## TL;DR
```powershell
Install-Package Highlight
``````csharp
var highlighter = new Highlighter(new HtmlEngine());
var highlightedCode = highlighter.Highlight("C#", csharpCode);
```## Syntax definitions
The following is a list of all the definition names of syntaxes/languages that are supported out of the box;- ASPX
- C
- C++
- C#
- COBOL
- Eiffel
- Fortran
- Haskell
- HTML
- Java
- JavaScript
- Mercury
- MSIL
- Pascal
- Perl
- PHP
- Python
- Ruby
- SQL
- Visual Basic
- VBScript
- VB.NET
- XML## Output engines
Highlight supports the notion of an output engine which makes it possible to get the syntax highlighted result output in any format. Out of the box Highlight support HTML, XML and RTF output formats.The HtmlEngine supports inline styles which can be enabled by setting the **UseCss** property to **true**;
```csharp
var highlighter = new Highlighter(new HtmlEngine { UseCss = true });
var highlightedCode = highlighter.Highlight("C#", csharpCode);
```