ToolBX.AwesomeMarkup 2.2.0

dotnet add package ToolBX.AwesomeMarkup --version 2.2.0
NuGet\Install-Package ToolBX.AwesomeMarkup -Version 2.2.0
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="ToolBX.AwesomeMarkup" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ToolBX.AwesomeMarkup --version 2.2.0
#r "nuget: ToolBX.AwesomeMarkup, 2.2.0"
#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 ToolBX.AwesomeMarkup as a Cake Addin
#addin nuget:?package=ToolBX.AwesomeMarkup&version=2.2.0

// Install ToolBX.AwesomeMarkup as a Cake Tool
#tool nuget:?package=ToolBX.AwesomeMarkup&version=2.2.0

AwesomeMarkup

AwesomeMarkup

Extracts any kind of markup information from a string of characters.

Good to know

This library is currently in beta and might not perform very well in all scenarios. It does better when used against short strings of text rather than entire documents.

If you're looking for a complete and ready-to-use dialog parsing library, use the DML.NET library instead.

Getting started

Setup

This library makes use of AutoInject to automatically inject its dependencies. If you already use AutoInject or AssemblyInitializer then you have nothing to do for this step.

If you are using dependency injection without AutoInject or AssemblyInitializer then you'll need to use the following in your initialization code :

services.AddAwesomeMarkup();

Injection

You also need to inject the IMarkupParser interface wherever you want to use it.

private readonly IMarkupParser _markupParser;

public SomeService(IMarkupParser markupParser)
{
	_markupParser = markupParser;
}

Parsing

//parsed.Text contains the text surrounded by the tags while the tags property contains information about the tags themselves
var parsed = _markupParser.Parse("Some <color=red>text</color> <underline>containing</underline> DML.");

//in the case of the color tag, its name is "color" and its value is "red"

//However, if we used attributes rather than the tag value...
var parsed = _markupParser.Parse("Some <color red=200 green=12 blue=54>text</color> <underline>containing</underline> DML.");

//the color tag would have no value but the attribute names "red", "green" and "blue" with values 200, 12 and 54 respectively.

//multiple nested tags are also supported if you want bold underlined colored text
var parsed = _markupParser.Parse("Some <color red=200 green=12 blue=54><underline><bold>text</bold></underline></color> <underline>containing</underline> DML.");

Known issues / TODO

AwesomeMarkup is an ambitious project that is actively developped but still in beta. Standard use cases as discussed above are covered but it may not work very well for edge/weird cases.

Full release is planned once the following is implemented :

  • Allow spaces inside attribute values that are surrounded by quotes (important, this next on the list)
  • Escapable brackets
  • Support for self-closing tags (such as <br /> in HTML)
  • You shouldn't be able to use unescaped tag brackets inside tags
  • Support for XML processing tags (ex : <?version?>) (not very critical since I don't expect short strings to have this but it should be at the very least basically supported)
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ToolBX.AwesomeMarkup:

Package Downloads
ToolBX.DML.NET

.NET implementation of the Dialog Markup Language.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 455 1/13/2024
2.2.0-beta1 91 1/7/2024
2.0.0-beta5 89 6/19/2023
2.0.0-beta4 207 4/27/2023
2.0.0-beta3 89 4/25/2023
2.0.0-beta2 182 11/9/2022
2.0.0-beta1 216 9/22/2022
1.0.0-beta1 151 9/22/2022
0.9.0-beta 437 3/15/2022