Skip to content
SheetForge

Markers and templates

Register your own per-column marker rows, and add your own templates to the list that Create sheet offers in the Data Studio. Both are opt-in plugin interfaces.

Custom structural markers

The built-in markers are @name, @type, @desc, and four optional ones. Markers shows how a sheet writes each one.

Optional markerWhat it describes
@overlapOne value per column, validated column by column
@styleThe sheet rather than its columns: its group label and color
@enumThe sheet as a set of enum definitions rather than a table
@locThe sheet as a localization sheet

@overlap is a per-column marker. You can register your own markers the same way. For example, a @curve marker can record how each numeric column interpolates.

The model to copy is @overlap, not @style, because @style describes the sheet.

Register a marker

Implement IStructuralMarkerDefinition and register it via ISheetForgeMarkerPlugin.

// A hypothetical plugin (the bundled Plugin Demo does not register a marker):
public sealed class CurvesPlugin : /* ... */, ISheetForgeMarkerPlugin
{
    public void RegisterStructuralMarkers(MarkerRegistry markers)
    {
        markers.Register(new CurveMarker());
    }
}
 
public sealed class CurveMarker : IStructuralMarkerDefinition
{
    public string MarkerName => "curve";                 // without '@' → the sheet row is @curve
    public string Description => "How this column interpolates (linear/ease/step).";
 
    // Validate this column's @curve cell. Empty is allowed (defaults to linear).
    public void ValidateCell(MarkerCellContext context)
    {
        string v = context.RawText.Trim();
        if (v.Length == 0) return;                        // you decide what an empty cell means
        if (v != "linear" && v != "ease" && v != "step")
            context.Reject("@curve must be linear, ease, or step", "use one of: linear, ease, step");
    }
}

Add the marker row to a sheet

The sheet then accepts a @curve row. The row can sit in any order, above the data. A duplicate row is rejected, and a marker row below the data is an error.

@name    | level | atk
@type    | int   | int
@curve   |       | ease
         | 1     | 10

Read the marker value

The value is stored as domain-agnostic metadata in FieldSchema.MarkerValues. For the @curve marker, it is field.MarkerValues["curve"].

The Core never interprets the value. Validation is delegated to your marker definition.

A domain validator or an edge contributor reads the value from context.Tables[tab].Schema.Fields[i].MarkerValues. The Data Studio shows the value in the column header tooltip.

Rejected cells

A rejected cell becomes a MarkerCellInvalid diagnostic. You supply the "why" and the "how to fix". The Core supplies the coordinate and the offending value.

Marker rules

  • Marker names must be valid identifiers.
  • Marker names must not collide with a built-in marker. Otherwise Register throws, surfaced as a PluginRegistrationConflict.
  • Markers are for per-column metadata, not new data shapes. A marker owns its cell validation, including what an empty cell means. It does not own the whole row.
  • Data shapes stay in normalization: references, List<T> and type columns. Reach for a custom marker only for genuinely verbose per-column annotations.
  • Custom marker rows are preserved verbatim on export and round-trip.
  • Every structure edit (add, delete, move, rename) moves a custom marker row's value with its column.
  • Marker values reach neither the generated code nor the baked databases. Like @overlap, they are validation and display metadata only, invisible to the schema fingerprint.

The built-in markers are the seven in SheetSyntax.ReservedMarkers: @name, @type, @desc, @overlap, @style, @enum and @loc. MarkerRegistry lists every case in which registration throws.

Create sheet templates

Press Create sheet in the Data Studio toolbar to see the templates. The list holds two built-in templates, then the templates that plugins register, then From scratch (define fields yourself). Create a sheet covers the rest of that dialog.

The two built-in templates are:

  • Item example (core types only), an items sheet using core types only.
  • Enum definitions, an @enum definitions sheet.

Domain templates are sheet skeletons that use your enums, custom types, and references. They come from plugins, so a template is present exactly when its plugin is.

Register a template

Implement ISheetForgeTemplatePlugin.

public sealed class SkillsPlugin : /* ... */, ISheetForgeTemplatePlugin
{
    public void RegisterTemplates(TemplateRegistry templates)
    {
        templates.Register(new DataTemplate(
            "skills.demo",                                   // registry key (unique; duplicates rejected)
            "Skill demo (Actions · Effects · Skills)",       // your own display string
            new List<DataTemplateTab>
            {
                // Each tab carries a full TSV: marker rows + example data.
                new DataTemplateTab("Actions", "@name\tcodeName\ttype\n@type\tRecordId\tEnum<ActionType>\n\tfireball\tProjectile"),
                new DataTemplateTab("Effects", /* ... */ ""),
                new DataTemplateTab("Skills",  /* ... */ ""),
            }));
    }
}

What a template carries

A template carries one or more tabs. Each tab is a complete normalized TSV: comment and marker rows plus example data. That is unlike the built-in item example, which is a 0-row skeleton.

Your domain types are already registered, because the plugin is loaded. The created sheets re-import successfully right away.

Multi-tab templates

Multi-tab templates create all their tabs and re-import once, so cross-tab references resolve together.

The Create sheet dialog hides the Tab name field for these templates, because the template fixes the tab names.

Display strings

The display name of a template is your own string. A plugin owns its own text, so you are not restricted to Core Loc keys.

Rejected registrations

Register throws in the cases below. Each one is surfaced as a PluginRegistrationConflict.

  • The registry key is empty or a duplicate. The key must be unique.
  • The display name is empty.
  • The template has zero tabs.
  • A tab's TSV is empty.

Next steps