ToolBX.AwesomeMarkup
2.0.0-beta1
See the version list below for details.
dotnet add package ToolBX.AwesomeMarkup --version 2.0.0-beta1
NuGet\Install-Package ToolBX.AwesomeMarkup -Version 2.0.0-beta1
<PackageReference Include="ToolBX.AwesomeMarkup" Version="2.0.0-beta1" />
paket add ToolBX.AwesomeMarkup --version 2.0.0-beta1
#r "nuget: ToolBX.AwesomeMarkup, 2.0.0-beta1"
// Install ToolBX.AwesomeMarkup as a Cake Addin #addin nuget:?package=ToolBX.AwesomeMarkup&version=2.0.0-beta1&prerelease // Install ToolBX.AwesomeMarkup as a Cake Tool #tool nuget:?package=ToolBX.AwesomeMarkup&version=2.0.0-beta1&prerelease
AwesomeMarkup
Extracts any kind of markup information from a string of characters.
Good to know
This is meant to be used for short strings of text such as spoken dialog in a video game and not for entire documents. I don't believe this library would perform very well in the latter scenario.
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.
1.0.0 is planned to be released 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 | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net7.0
- ToolBX.AutoInject (>= 2.0.0-beta1)
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 |
---|---|---|
3.0.0 | 1,130 | 9/27/2024 |
3.0.0-beta1 | 108 | 9/23/2024 |
2.2.0 | 842 | 1/13/2024 |
2.2.0-beta1 | 135 | 1/7/2024 |
2.0.0-beta5 | 119 | 6/19/2023 |
2.0.0-beta4 | 251 | 4/27/2023 |
2.0.0-beta3 | 120 | 4/25/2023 |
2.0.0-beta2 | 239 | 11/9/2022 |
2.0.0-beta1 | 260 | 9/22/2022 |
1.0.0-beta1 | 193 | 9/22/2022 |
0.9.0-beta | 505 | 3/15/2022 |