MarkupString.Mxp
2.5.0
dotnet add package MarkupString.Mxp --version 2.5.0
NuGet\Install-Package MarkupString.Mxp -Version 2.5.0
<PackageReference Include="MarkupString.Mxp" Version="2.5.0" />
<PackageVersion Include="MarkupString.Mxp" Version="2.5.0" />
<PackageReference Include="MarkupString.Mxp" />
paket add MarkupString.Mxp --version 2.5.0
#r "nuget: MarkupString.Mxp, 2.5.0"
#:package MarkupString.Mxp@2.5.0
#addin nuget:?package=MarkupString.Mxp&version=2.5.0
#tool nuget:?package=MarkupString.Mxp&version=2.5.0
MarkupString.Mxp
MXP for MarkupString: writes core's shared
vocabulary — sounds, music, pictures, panes, gauges, status, variables, link expiry, relocation and
login prompts — as MXP's own elements, and holds each to what the client said it supports.
You say a thing once; this package is how an MXP client hears it. The same text goes to a Pueblo
client through MarkupString.Pueblo, to a browser through MarkupString.Html, and to a terminal,
which gets a picture's description, a pane's text, and nothing for a sound.
dotnet add package MarkupString.Mxp
Usage
using MarkupString;
using MarkupString.Ansi;
using MarkupString.Html;
using MarkupString.Mxp;
var registry = MarkupRegistry.Empty.WithAnsi().WithHtml().WithMxp().WithMxpSecureLines();
var line = MarkupText.Concat([
MarkupText.Sound("https://example.test/sounds/door.wav", volume: 80),
MarkupText.Pane(MarkupText.Plain("North: the gate"), "map", "The Map")]);
line.Render(MarkupFormat.Mxp, registry);
// ESC[1z<SOUND door.wav V=80 U=https://example.test/sounds/><FRAME map TITLE="The Map"><DEST map>North: the gate</DEST>
These are MXP's secure elements, which a client acts on only on a line opened in secure mode, so render
through a registry with WithMxpSecureLines().
What the client supports
MXP lets a server ask which elements a client renders (<SUPPORT>), and a client that answered
-image should not be sent one. Pass the answer as a predicate over the names in
MxpRegistration.Elements:
var answered = new HashSet<string>(["SOUND", "MUSIC", "VAR"], StringComparer.OrdinalIgnoreCase);
var registry = MarkupRegistry.Empty.WithAnsi().WithMxp(answered.Contains).WithMxpSecureLines();
An element the client refused is written as a format without MXP writes it: nothing for a sound, the description for a picture, the text in the main window for a pane. With no predicate every element is written. Asking belongs to the telnet layer, and the answer to one connection.
Elements
| Factory | Written as |
|---|---|
MarkupText.Sound(source, volume, repeats) |
<SOUND file V= L= U=> |
MarkupText.Music(source, volume, repeats, continues) |
<MUSIC file V= L= C=1 U=> |
MarkupText.StopSound(channel) |
<SOUND Off>, <MUSIC Off> |
MarkupText.Image(source, description, width, height, align) |
<IMAGE file URL= W= H= ALIGN=> |
MarkupText.Pane(content, name, title) |
<FRAME name TITLE=><DEST name>content</DEST> |
MarkupText.ExpireLinks(group) |
<EXPIRE group> |
MarkupText.Relocate(host, port, quiet) |
<RELOCATE host port QUIET> |
MarkupText.LoginPrompt(field) |
<USER>, <PASSWORD> |
MarkupText.Variable(content, name) |
<VAR name>content</VAR> |
MarkupText.Gauge(content, variable, maximum, caption, color) |
<GAUGE variable MAX= CAPTION= COLOR=> |
MarkupText.Status(content, variable, maximum, caption) |
<STAT variable MAX= CAPTION=> |
An absolute address is split into the file and the directory MXP downloads it from (U=, URL=).
Syntax is from the MXP specification.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MarkupString (>= 2.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.