Ookii.FormatC
2.3.2
dotnet add package Ookii.FormatC --version 2.3.2
NuGet\Install-Package Ookii.FormatC -Version 2.3.2
<PackageReference Include="Ookii.FormatC" Version="2.3.2" />
paket add Ookii.FormatC --version 2.3.2
#r "nuget: Ookii.FormatC, 2.3.2"
// Install Ookii.FormatC as a Cake Addin #addin nuget:?package=Ookii.FormatC&version=2.3.2 // Install Ookii.FormatC as a Cake Tool #tool nuget:?package=Ookii.FormatC&version=2.3.2
Ookii.FormatC
FormatC is a class library for Microsoft .Net that provides syntax highlighting for several programming languages. FormatC includes support for C#, Visual Basic, C++, XML, Transact-SQL and PowerShell. FormatC can be extended to support other languages if necessary.
FormatC takes as input source code in any of the supported languages, and produces HTML as output containing the syntax highlighted source. You need to use the provided CSS file for the syntax highlighting to work. CSS is provided for both light and dark styles, and you can customize the CSS file to suit your own syntax highlighting preferences.
FormatC is not heavily developed, and adding support for additional languages is unlikely at this point. However, it is still maintained because of a few features that are rare in other syntax highlighters, such as highlighting type names in C# code and parser-based PowerShell formatting.
FormatC's syntax highlighting uses regular expressions, and as such isn't incredibly fast. It's intended use is to add highlighting to small code snippets for inclusion on web pages, not to highlight large files.
Formatting source code is easy. Here is an example of how to format C# code:
var formatter = new CodeFormatter()
{
formatter.FormattingInfo = new CSharpFormattingInfo()
};
var code = File.ReadAllText("code.cs");
var formattedCode = formatter.FormatCode(code);
You can also write directly to a TextWriter
.
For more information, including CSS stylesheets required to view the highlighted output, see the GitHub project page.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Microsoft.CSharp (>= 4.7.0)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
For details, see https://www.ookii.org/Link/FormatCVersionHistory