Skip to content
forked from tatwd/prism-sharp

A porting of PrismJS to C# or .NET.

License

Notifications You must be signed in to change notification settings

BUTR/prism-sharp

 
 

Repository files navigation

PrismSharp

A porting of PrismJS to C# or .NET.

All supported language grammars are here.

Getting Started

Tokenize Code

Install PrismSharp.Core package:

dotnet add package PrismSharp.Core --prerelease

Then,

using PrismSharp.Core;

var text = @"<p>Hello world!</p>";
var grammar = LanguageGrammars.Html; // or defined yourself
var tokens = Prism.Tokenize(text, grammar);

Highlight Code

Install PrismSharp.Highlighting.HTML package:

dotnet add package PrismSharp.Highlighting.HTML --prerelease

Then,

using PrismSharp.Core;
using PrismSharp.Highlighting.HTML;

var text = @"<p>Hello world!</p>";
var grammar = LanguageGrammars.Html; // or defined yourself
var highlighter = new HtmlHighlighter();
var html = highlighter.Highlight(text, grammar, "html");

The css styles can customize yourself, or download from PrismJS.

About

A porting of PrismJS to C# or .NET.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 88.9%
  • JavaScript 10.0%
  • PowerShell 1.1%