Back to API Reference
Class

ModifierClipboardSchema

sealed

Per-modifier-type declaration of how the modifier's semantic effect maps onto external clipboard formats, registered in ClipboardModifierBindMap to opt the type into HTML / Markdown round-trip; the active clipboard adapters (IClipboardAdapter) walk this schema set when serializing copy and matching elements on paste.

Remarks

The schema is the semantic ↔ external-syntax bridge. Source-side syntax (<b>...</b> for TagParseRule, **...** for a Markdown rule) stays a rule-side concern — multiple rules can drive the same modifier, and only the rule knows its own tag name. The modifier owns the external mapping because the external mapping is determined by what the modifier means, not by how it is written in UniText source. Industry parallels: ProseMirror's MarkSpec.toDOM/parseDOM and Lexical's LexicalNode.exportDOM/importDOM put the external-format mapping on the semantic unit, not on the parser — UniText follows the same shape.
public ModifierHtmlSchema Html{ get }

HTML element mapping. when the modifier has no HTML representation.

public ModifierMarkdownSchema Markdown{ get }

Markdown delimiter mapping. when the modifier has no Markdown representation.

public string CanonicalTagName{ get }

UniText source-side tag name for this modifier — the name the paste gate matches against the field's styles. E.g. "b" for bold, "color" for color, "link" for links. Differs from RecognizedElements when the HTML element name does not match the conventional UniText tag (color uses <span style="color:..."> in HTML but <color=...> in UniText source). when the modifier has no canonical tag.

public bool MatchesSourceTagName{ get }

When set, the modifier's UniText tag names ARE its HTML element names, per style (InlineMatchingElements): copy emits the matched style's own tag as the element via the {tagName} template placeholder, and paste of an element applies only the style whose tag equals it. Such a schema has no single CanonicalTagName — one modifier drives several paired styles (sup and sub).

[ctor]public ModifierClipboardSchema()
public static ModifierClipboardSchema DoHtml()

Shortcut for a schema that only declares an HTML representation. Suits the common case of inline modifiers paired with a single open/close element pair.

public static ModifierClipboardSchema HtmlInline()

Shortcut for parameterless inline modifiers with HTML representation only. The first recognised element name builds the open and close tags. Pass synonyms (e.g. "b", "strong") after the primary element.

public static ModifierClipboardSchema InlineFormat()

Shortcut for parameterless inline modifiers with both HTML and Markdown representations. The HTML side mirrors HtmlInline; the Markdown side wraps the inner text with markdownMarker on both ends (e.g. ** for bold, * for italic, ~~ for strikethrough).

public static ModifierClipboardSchema InlineFormatStyled()

Inline format recognised by its semantic elements AND by CSS on a span (the Google-Docs clipboard convention), where the CSS off-value also CANCELS a semantic element match — the Docs <b style="font-weight:normal"> fragment wrapper must not bold its content. Copy emits the first element; markdown may be for HTML-only formats (underline).

public static ModifierClipboardSchema MarkdownDelimited()

Shortcut for a schema that only declares a Markdown representation. Same open and close marker for both sides (e.g. ** for bold, * for italic).

public static ModifierClipboardSchema InlineStyle()

Shortcut for parameterised modifiers that map to a single CSS property on a <span>. Copy emits <span style="PROP:VALUE"> with the modifier's tag parameter as VALUE; paste recognises any <span> whose style attribute carries PROP: and returns the property value back as the UniText tag parameter. Used by color, size, letter-spacing, line-height, etc. valueFormat selects the value converters bridging UniText's unit grammar and CSS in both directions — values with no valid rendering on the other side are skipped, never emitted invalid or fed unparseable into a rule.

public static ModifierClipboardSchema InlineStyle()
public static ModifierClipboardSchema InlineMatchingElements()

Shortcut for modifiers whose UniText tag name matches the HTML element name directly (one schema covers <sup>/<sub>, <mark>, <kbd>, etc.). The active style's tag name is spliced into the open and close tag templates via the literal placeholder {tagName}, so the same modifier can drive multiple paired styles (one Style for sup, another for sub) without separate schemas.

public static ModifierClipboardSchema InlineStyleValue()

Shortcut for parameterless modifiers whose presence is signalled by a fixed CSS property/value pair on a <span> — e.g. uppercase via text-transform:uppercase, small-caps via font-variant:small-caps. Copy emits a literal <span style="PROP:VALUE">; paste matches a <span> whose style declares the same property with the same value (case-insensitive comparison).

public static ModifierClipboardSchema InlineWithAttribute()

Shortcut for inline modifiers that map to a single HTML attribute on a dedicated element — e.g. <a href="URL"> for link, <abbr title="…"> for abbreviation, <cite> for citation. Copy emits <ELEMENT ATTR="VALUE">; paste returns the attribute value back as the UniText tag parameter.

public static string ExtractAttribute()

Reads a single HTML attribute value from a raw element attribute slice. Handles surrounding whitespace (including the newline-separated attributes Word emits), both quote styles around the value, and name substrings inside other attribute names or values (data-style, class="header-style") — a candidate that fails the boundary or = check moves on to the next occurrence instead of giving up. The value is entity-decoded. Returns when the attribute is not present.

public static string ExtractCssProperty()

Reads a single CSS property value from a raw element attribute slice: locates the real style attribute via ExtractAttribute (boundary-checked and entity-decoded), then scans its semicolon-separated declarations for property with a word-boundary check (so font-size never matches inside x-font-size). Returns when the property is not present.