MarkdownExtension.h header

#include <ew/app/MarkdownExtension.h>

Namespace ew::app

BlockStyleExt struct

struct ew::app::BlockStyleExt

The block (paragraph / heading) styling that plain Markdown cannot express: alignment, line spacing, indent level, and a named paragraph style. Serialized as a leading attribute line {.ew ...} before the block; only non-default attributes are emitted. See docs/MARKDOWN_EDITING.md for the grammar.

Members

QString ew::app::BlockStyleExt::align

Alignment: "center", "right", or "justify"; empty for the default (leading/left).

double ew::app::BlockStyleExt::spacing = 0.0

Line-spacing multiple (e.g. 1.5), or 0 for single/default.

int ew::app::BlockStyleExt::indent = 0

Indent level (0 = none/default).

QString ew::app::BlockStyleExt::namedStyle

Named paragraph style (e.g. "Title", "Heading 1"), or empty for none.

bool ew::app::BlockStyleExt::isDefault() const

Whether every attribute is at its default (so no extension line need be emitted).

bool operator==(const BlockStyleExt &, const BlockStyleExt &)=default

Value equality over all fields.

InlineStyleExt struct

struct ew::app::InlineStyleExt

The inline run styling that plain Markdown/GFM cannot express – the "beyond Markdown" set the desktop editor can produce for a text run: colour, highlight, font family/size, underline, and super/subscript. (Bold, italic, strikethrough, and inline code ARE plain Markdown and are never carried here.) Serialized as a namespaced attribute span [text]{.ew ...} so a plain Markdown reader ignores it; only non-default attributes are emitted, keeping ordinary prose clean and diffs quiet. See docs/MARKDOWN_EDITING.md (the segment SSOT) for the grammar.

Members

QString ew::app::InlineStyleExt::color

Foreground colour as "#rrggbb" (lower-case), or empty for the default text colour.

QString ew::app::InlineStyleExt::background

Background / highlight colour as "#rrggbb", or empty for none.

QString ew::app::InlineStyleExt::fontFamily

Font family name (may contain spaces), or empty for the document default.

int ew::app::InlineStyleExt::fontSize = 0

Font point size, or 0 for the document default.

bool ew::app::InlineStyleExt::underline = false

Underline.

bool ew::app::InlineStyleExt::superscript = false

Superscript (mutually exclusive with subscript; superscript wins if both are somehow set).

bool ew::app::InlineStyleExt::subscript = false

Subscript.

bool ew::app::InlineStyleExt::isDefault() const

Whether every attribute is at its default (so no extension span need be emitted).

bool operator==(const InlineStyleExt &, const InlineStyleExt &)=default

Value equality over all fields (round-trip + fixed-point tests compare these).

Functions

bool ew::app::isExtensionToken(QStringView text)

Whether text is a well-formed .ew extension token: {.ew ... } (optionally with trailing content after the closing brace ignored by the caller). Used to detect the extension before parsing.

BlockStyleExt ew::app::parseBlockStyle(QStringView token)

Parses a full block extension token token ({.ew ...}) into a style; unknown attributes are ignored. Exact inverse of serializeBlockStyle for a canonically-serialized token.

InlineStyleExt ew::app::parseInlineStyle(QStringView token)

Parses a full inline extension token token (the {.ew ...} attribute span, braces included) into a style. Unknown attributes are ignored (forward-compatible); a token that is not a well-formed .ew span yields a default style. Exact inverse of serializeInlineStyle for a canonically-serialized token.

QString ew::app::serializeBlockStyle(const BlockStyleExt &style)

Serializes style to a full block extension token {.ew ...} (e.g. {.ew align=center spacing=1.5 indent=2 style="Heading 1"}), only non-default attributes, in a fixed order. Empty when the style is default.

QString ew::app::serializeInlineStyle(const InlineStyleExt &style)

Serializes style to a full inline extension token {.ew ...} (e.g. {.ew color=#1a2b3c bg=#ffff00 font="Georgia Pro" size=14 u sup}), emitting only the non-default attributes in a fixed canonical order. Returns an empty string when the style is default (so the caller writes the plain run with no attribute span).