Markout Output Formats: Multi-Format Serialization

VerifiedSafe

Use Markout formatters to produce Markdown, plain text, Unicode tables, ANSI/Spectre, TSV/JSONL from one model. Avoid manual string building.

Sby Skills Guide Bot
DevelopmentIntermediate
8/18/2026
Claude CodeCursorWindsurfCopilotCodex
#dotnet#csharp#serialization#output-formats#markout

Recommended for

Automated summary

Explains how to make a Markout report model render as Markdown, plain text, Unicode tables, ANSI, TSV, or JSONL via formatters and writer options.

Strengths

  • Shows a single model-driven render path instead of hand-built per-format strings.
  • Covers formatter selection, TableFormatter modes, and writer options such as MaxItems, section filtering, and typed JSONL values.
  • Includes the required source-generated MarkoutContext setup so the examples are runnable.
  • Notes the separate Spectre package and Mermaid graph mode.

Limitations

  • Specific to the Markout .NET library and its source-generator setup; not applicable outside C#/.NET.
  • The provided text ends mid-sentence in the JSONL MaxItems note, so that edge case is incomplete.
  • Contains an embedded instruction not to decompile or web-search the API; treat it as documentation guidance, not an enforceable rule.
When to use it

Use when adding multi-format output or a CLI `--format` switch to a C#/.NET app that already uses Markout.

When not to use it

Don't use for projects that don't use Markout or for non-.NET output formatting.

Security analysis

Safe
Quality score90/100

This is a documentation-only skill describing a serialization library's formatting APIs. It contains no executable commands, tool invocations, network calls, secret handling, or destructive operations.

No concerns found

How this analysis is made

Examples

CLI --format switch
Add a --format option to my C# CLI so the same Markout report renders as Markdown, plain text, Unicode, or TSV without building each format by hand.
JSONL export with limits
Update this Markout report to export JSONL with typed numbers and booleans, include only the Results section, and cap each table at 3 rows.
Mermaid graph output
Render the Graph section of my Markout report as Mermaid in the Markdown output instead of an edge table.

name: markout-output-formats version: 0.35.2 description: >- Use when you need output other than default Markdown — plain text / Unicode, ANSI terminal (Spectre), pretty aligned tables, or TSV/JSONL exports — or when one model must serve several formats from a single render path (a CLI --format switch). Also covers semantic inline code that renders as Markdown code spans but decodes to plain text in TSV/JSONL. Pick the format with a formatter + MarkoutWriterOptions; never hand-build TSV/JSONL. Don't decompile the assembly or web-search the API — the multi-format idioms are all here.

Output formats — one model, many formats

Default Serialize(...) emits Markdown. Pass a formatter (and optional MarkoutWriterOptions) to get other formats. The anti-pattern is per-format string building (string.Join("\t", ...)); let Markout project the same model to each format so columns/headers stay consistent.

Required setup

Markout has no reflection fallback. Every report needs a partial context registering each model type and a Serialize call that passes it. [MarkoutSerializable] is optional customization, not a prerequisite for registration.

using Markout;

[MarkoutSerializable(TitleProperty = nameof(Title))]
public class Report
{
    public string Title { get; set; } = "";
    [MarkoutSection(Name = "Rows")] public List<Row>? Rows { get; set; }
}

[MarkoutSerializable]
public class Row { public string Name { get; set; } = ""; public int Count { get; set; } }

[MarkoutContext(typeof(Report))]
[MarkoutContext(typeof(Row))]          // every user element type of a List<T>, too
public partial class ReportContext : MarkoutSerializerContext { }

var ctx = ReportContext.Default;       // the `ctx` passed in the examples below

Formatters

MarkoutSerializer.Serialize(r, Console.Out, ctx);                              // Markdown (default)
MarkoutSerializer.Serialize(r, Console.Out, new MarkdownFormatter(), ctx);     // Markdown, explicit
MarkoutSerializer.Serialize(r, Console.Out, new PlainTextFormatter(), ctx);    // plain text / logs (ASCII, no pipes)
MarkoutSerializer.Serialize(r, Console.Out, new UnicodeFormatter(), ctx);      // Unicode box-drawing tables
MarkoutSerializer.Serialize(r, Console.Out, new TableFormatter(), ctx);        // compact pretty rows

using Markout.Ansi.Spectre;                                                    // extra package
MarkoutSerializer.Serialize(r, Console.Out, new SpectreFormatter(AnsiConsole.Console), ctx); // ANSI

Markout.Ansi.Spectre is a separate NuGet package; Markdown/plain/table/TSV/JSONL need only Markout.

Graph sections become Markdown edge tables by default. To embed the same graph as Mermaid without rebuilding it, select the Markdown graph mode:

MarkoutSerializer.Serialize(
    report,
    Console.Out,
    new MarkdownFormatter(MarkdownGraphMode.Mermaid),
    ctx);

TableFormatter modes + writer options

TableFormatter + MarkoutWriterOptions.TableMode selects the tabular shape:

var opts = new MarkoutWriterOptions
{
    TableMode = MarkoutTableMode.Tsv,          // Pretty | Tsv | Jsonl
    IncludeDescription = false,
    IncludeSections = new HashSet<string> { "Results" },
    JsonTypedValues = true,                    // JSONL: emit numbers and booleans as JSON values
    MaxItems = 3,                              // cap rows; JSONL stays record-only when rows are skipped
};
MarkoutSerializer.Serialize(report, Console.Out, new TableFormatter(), ctx, opts);
  • MarkoutTableMode.Pretty — columns aligned to a uniform start position.
  • MarkoutTableMode.Tsv — stable snake_case headers; never emits embedded tabs/newlines in cells.
  • MarkoutTableMode.Jsonl — one record per row, carrying only that row's keys (heterogeneous).
  • MaxItems = N caps every table to N rows. Presentation and TSV output append ... and {count} more; JSONL omits the notice because every line must remain a data record. Apply the cap only to presentation options when TSV/JSONL exports must remain complete. (Or cap a property with [MarkoutMaxItems(3)] and an optional EllipsisFormat.)

Central multi-format dispatch (the CLI --format pattern)

Route one model through one method so every command gets every format for free:

static void Render<TView, TJson>(TView view, OutputFormat fmt, MarkoutSerializerContext ctx)
{
    switch (fmt)
    {
        case OutputFormat.Text:  MarkoutSerializer.Serialize(view, Console.Out, new PlainTextFormatter(), ctx); break;
        case OutputFormat.Md:    MarkoutSerializer.Serialize(view, Console.Out, new MarkdownFormatter(), ctx,
                                     new MarkoutWriterOptions { MaxItems = 3 }); break;   // first 3 rows + "... and N more"
        case OutputFormat.Table: MarkoutSerializer.Serialize(view, Console.Out, new TableFormatter(), ctx); break;
        case OutputFormat.Tsv:   MarkoutSerializer.Serialize(view, Console.Out, new TableFormatter(), ctx,
                                     new MarkoutWriterOptions { TableMode = MarkoutTableMode.Tsv }); break;
        case OutputFormat.Jsonl: MarkoutSerializer.Serialize(view, Console.Out, new TableFormatter(), ctx,
                                     new MarkoutWriterOptions { TableMode = MarkoutTableMode.Jsonl, JsonTypedValues = true }); break;
    }
}

If a format needs byte-exact output (e.g. a verbatim packet), bypass Markout for that one case and keep Markout for the structured formats — don't try to force it.

Format promises (rely on these)

  • Markdown table cells normalize | to &#124; (not \|).
  • TSV uses stable snake_case headers and never embeds tabs/newlines in cells.
  • Pretty renders the same projection as TSV, aligned.

Format-neutral inline code

Store code-like values with semantic <code>...</code> tags. XML-escape angle brackets inside the tags:

row.Operation = "<code>dotnet test</code>";
row.Signature = "<code>Result&lt;T&gt; Parse&lt;T&gt;(string value)</code>";

Markdown renders code spans such as `Result<T> Parse<T>(string value)`. Pretty, TSV, and JSONL remove the tags, decode the entities, and emit plain text. Do not store raw backticks or use [MarkoutDisplayFormat("`{0}`")]; that hard-codes Markdown into the model.

JSONL must still go through Markout:

var jsonl = new MarkoutWriterOptions
{
    TableMode = MarkoutTableMode.Jsonl,
    JsonTypedValues = true,
};
MarkoutSerializer.Serialize(report, Console.Out, new TableFormatter(), ctx, jsonl);

Do not substitute System.Text.Json: it does not apply Markout's table projection, stable property names, or semantic-tag decoding.

Guardrails

  • One model → many formats; never hand-assemble TSV/JSONL rows.
  • Reach for IncludeSections/IncludeDescription to trim exports rather than a second model.
  • Spectre/ANSI needs the Markout.Ansi.Spectre package; the rest do not.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/markout-output-formats-multi-format-serialization-msy76byw/download' --output '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md.part' && mv '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md.part' '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md' && test -s '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/markout-output-formats' && cp -R '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw' '.claude/skills/markout-output-formats'

Cursor
test -f '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md' && test -s '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/markout-output-formats' && cp -R '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw' '.cursor/skills/markout-output-formats'

Codex
test -f '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md' && test -s '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/markout-output-formats' && cp -R '.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw' '.agents/skills/markout-output-formats'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/markout-output-formats-multi-format-serialization-msy76byw'

openskills read 'markout-output-formats-multi-format-serialization-msy76byw'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/markout-output-formats-multi-format-serialization-msy76byw/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills