Smdn.LibHighlightSharp 1.0.0-preview3

Prefix Reserved
This is a prerelease version of Smdn.LibHighlightSharp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Smdn.LibHighlightSharp --version 1.0.0-preview3                
NuGet\Install-Package Smdn.LibHighlightSharp -Version 1.0.0-preview3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Smdn.LibHighlightSharp" Version="1.0.0-preview3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Smdn.LibHighlightSharp --version 1.0.0-preview3                
#r "nuget: Smdn.LibHighlightSharp, 1.0.0-preview3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Smdn.LibHighlightSharp as a Cake Addin
#addin nuget:?package=Smdn.LibHighlightSharp&version=1.0.0-preview3&prerelease

// Install Smdn.LibHighlightSharp as a Cake Tool
#tool nuget:?package=Smdn.LibHighlightSharp&version=1.0.0-preview3&prerelease                

Smdn.LibHighlightSharp-1.0.0-preview3

Provides wrapper classes for using various versions of André Simon's Highlight on .NET.

API List

List of APIs exposed by assembly Smdn.LibHighlightSharp-1.0.0-preview3 (net6.0)

// Smdn.LibHighlightSharp.dll (Smdn.LibHighlightSharp-1.0.0-preview3)
//   Name: Smdn.LibHighlightSharp
//   AssemblyVersion: 1.0.0.0
//   InformationalVersion: 1.0.0-preview3+ec85410b835bb13a16872c9d1482d3e56deabaec
//   TargetFramework: .NETCoreApp,Version=v6.0
//   Configuration: Release
#nullable enable annotations

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Xml.Linq;
using Smdn.LibHighlightSharp;
using Smdn.LibHighlightSharp.Bindings;

namespace Smdn.LibHighlightSharp {
  public enum GeneratorOutputType : int {
    BBCode = 8,
    EscapeSequencesAnsi = 5,
    EscapeSequencesTrueColor = 11,
    EscapeSequencesXterm256 = 6,
    Html = 0,
    LaTeX = 3,
    Odt = 10,
    Pango = 9,
    Rtf = 4,
    Svg = 7,
    TeX = 2,
    Xhtml = 1,
  }

  public enum HighlightElementType : int {
    Default = 1,
    ErrorMessage = 18,
    EscapedCharacter = 6,
    HoverText = 16,
    KeywordA = 12,
    KeywordB = 13,
    KeywordC = 14,
    KeywordD = 15,
    LineNumber = 9,
    MultiLineComment = 5,
    Number = 3,
    Operator = 10,
    Other = 0,
    Preprocessor = 7,
    PreprocessorString = 8,
    SingleLineComment = 4,
    StringInterpolation = 11,
    Strings = 2,
    SyntaxError = 17,
  }

  public class Highlight : IDisposable {
    public static readonly Version MinimumVersionSupportingBase16Themes; // = "3.44"
    public static readonly Version MinimumVersionSupportingGuessFileType; // = "3.51"
    public static readonly Version MinimumVersionSupportingLoadFileTypesConfig; // = "3.51"

    public static DataDir? CreateDefaultDataDir() {}

    public Highlight(DataDir dataDir, GeneratorOutputType outputType = GeneratorOutputType.Html, bool shouldDisposeDataDir = false) {}
    public Highlight(DataDir dataDirForSyntaxes, DataDir dataDirForThemes, GeneratorOutputType outputType = GeneratorOutputType.Html, bool shouldDisposeDataDir = false) {}
    public Highlight(GeneratorOutputType outputType = GeneratorOutputType.Html) {}
    public Highlight(string dataDir, GeneratorOutputType outputType = GeneratorOutputType.Html) {}
    public Highlight(string dataDirForSyntaxes, string dataDirForThemes, GeneratorOutputType outputType = GeneratorOutputType.Html) {}

    public string BaseFont { get; set; }
    public string BaseFontSize { get; set; }
    public bool Fragment { get; set; }
    public string? GeneratorVersionString { get; }
    public bool IncrementWrappedLineNumber { get; set; }
    public bool IsolateTags { get; set; }
    public bool KeepInjections { get; set; }
    public string? LastSyntaxError { get; }
    public int LineNumberWidth { get; set; }
    public bool LineNumberZeroPadding { get; set; }
    public bool OmitVersionComment { get; set; }
    public GeneratorOutputType OutputType { get; }
    public bool PrintLineNumbers { get; set; }
    public string StyleInputPath { get; set; }
    public string StyleName { get; }
    public string StyleOutputPath { get; set; }
    public string? SyntaxCategoryDescription { get; }
    public string? SyntaxDescription { get; }
    public string? SyntaxEncodingHint { get; }
    public string? ThemeCategoryDescription { get; }
    public string? ThemeDescription { get; }
    public string Title { get; set; }
    public bool ValidateInput { get; set; }

    protected virtual void Dispose(bool disposing) {}
    public void Dispose() {}
    public string Generate(string input) {}
    public void Generate(string inputPath, string outputPath) {}
    public string GenerateFromFile(string path) {}
    public string GuessFileType(string inputFilePath) {}
    public void LoadFileTypesConfig(string fileTypesConfPath) {}
    public void SetEncoding(string encodingName) {}
    public void SetIncludeStyle(bool trueForInclude) {}
    public void SetSyntax(string name) {}
    public void SetSyntaxFromFile(string pathToLangFile) {}
    public void SetTheme(string name) {}
    public void SetThemeBase16(string name) {}
    public void SetThemeFromFile(string pathToThemeFile) {}
    public bool TryFindSyntaxFile(string name, [NotNullWhen(true)] out string? syntaxFilePath) {}
    public bool TryFindThemeBase16File(string name, [NotNullWhen(true)] out string? themeFilePath) {}
    public bool TryFindThemeFile(string name, [NotNullWhen(true)] out string? themeFilePath) {}
    public bool TryLoadFileTypesConfig() {}
  }

  public sealed class HighlightHtmlClass :
    IEquatable<HighlightHtmlClass>,
    IEquatable<string>
  {
    public static HighlightHtmlClass Default { get; }
    public static HighlightHtmlClass DefaultV3 { get; }
    public static HighlightHtmlClass DefaultV4 { get; }
    public static HighlightHtmlClass ErrorMessage { get; }
    public static HighlightHtmlClass EscapedCharacter { get; }
    public static HighlightHtmlClass Highlight { get; }
    public static HighlightHtmlClass HoverText { get; }
    public static HighlightHtmlClass KeywordA { get; }
    public static HighlightHtmlClass KeywordB { get; }
    public static HighlightHtmlClass KeywordC { get; }
    public static HighlightHtmlClass KeywordD { get; }
    public static HighlightHtmlClass LineNumber { get; }
    public static HighlightHtmlClass MultiLineComment { get; }
    public static HighlightHtmlClass Number { get; }
    public static HighlightHtmlClass Operator { get; }
    public static HighlightHtmlClass Preprocessor { get; }
    public static HighlightHtmlClass PreprocessorString { get; }
    public static HighlightHtmlClass SingleLineComment { get; }
    public static HighlightHtmlClass StringInterpolation { get; }
    public static HighlightHtmlClass Strings { get; }
    public static HighlightHtmlClass StringsV3 { get; }
    public static HighlightHtmlClass StringsV4 { get; }
    public static HighlightHtmlClass SyntaxError { get; }

    public static bool TryParse(string className, [NotNullWhen(true)] out HighlightHtmlClass? @class) {}
    public static bool TryParsePrefixed(string prefixedClassName, [NotNullWhen(true)] out HighlightHtmlClass? @class) {}

    public string ClassName { get; }
    public HighlightElementType ElementType { get; }

    public bool Equals(HighlightHtmlClass? other) {}
    public bool Equals(string? other) {}
    public override bool Equals(object? obj) {}
    public override int GetHashCode() {}
    public override string ToString() {}
  }

  public class HighlightParserException : InvalidOperationException {
    public HighlightParserException(string message) {}
    public HighlightParserException(string message, ParseError reason) {}

    public ParseError Reason { get; }
  }

  public class HighlightSyntaxException : InvalidOperationException {
    public HighlightSyntaxException(string langFilePath, LoadResult reason) {}
    public HighlightSyntaxException(string message) {}

    public string? LangFilePath { get; }
    public LoadResult Reason { get; }
  }

  public class HighlightThemeException : InvalidOperationException {
    public HighlightThemeException(string message) {}
    public HighlightThemeException(string themeFilePath, string? reason) {}

    public string? Reason { get; }
    public string? ThemeFilePath { get; }
  }
}

namespace Smdn.LibHighlightSharp.Xhtml {
  public class XhtmlHighlight : Highlight {
    protected static IEnumerable<(XElement HighlightedElement, HighlightHtmlClass HighlightClass)> EnumerateHighlightedElements(XContainer container) {}

    public XhtmlHighlight() {}
    public XhtmlHighlight(DataDir dataDir, bool shouldDisposeDataDir = false) {}
    public XhtmlHighlight(DataDir dataDirForSyntaxes, DataDir dataDirForThemes, bool shouldDisposeDataDir = false) {}
    public XhtmlHighlight(string dataDir) {}
    public XhtmlHighlight(string dataDirForSyntaxes, string dataDirForThemes) {}

    public bool PreserveWhitespace { get; set; }

    public XDocument GenerateXhtmlDocument(string input) {}
    public XDocument GenerateXhtmlDocumentFromFile(string path) {}
    public IEnumerable<XNode> GenerateXhtmlFragment(string input) {}
    public IEnumerable<XNode> GenerateXhtmlFragmentFromFile(string path) {}
    protected virtual void PostProcessXhtml(XContainer container) {}
  }
}

NOTICE

This package uses the following components via the package Smdn.LibHighlightSharp.Bindings:

Highlight

The dependent package Smdn.LibHighlightSharp.Bindings uses Highlight, and is licensed under the GNU General Public License v3.0 (see COPYING.txt).

Lua (Windows only)

For Windows, the dependent package Smdn.LibHighlightSharp.Bindings bundles Lua Windows DLL which Highlight depends, and is licensed under the MIT License:

Copyright © 1994–2021 Lua.org, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 186 2/4/2024
1.1.4 263 6/6/2023
1.1.3 528 12/18/2022
1.1.2 345 12/14/2022
1.1.1 376 12/11/2022 1.1.1 is deprecated because it has critical bugs.
1.1.0 419 12/6/2022
1.0.0 1,518 12/1/2022
1.0.0-preview3 151 11/30/2022