Skip to content

Docs: Markdown inline code selector should be RichSpan.code, not RichRun.code #116

@TomOSullivan

Description

@TomOSullivan

Describe the bug

Summary

The Markdown styling documentation
instructs users to style inline code spans with the selector RichRun.code. In the
shipping control, the code class is applied to a RichSpan, not a RichRun, so
the documented RichRun.code selector matches no elements and has no effect.

The working selector is RichSpan.code.

Environment

  • Avalonia.Controls.Markdown 12.1.2
  • Avalonia 12.0.3
  • OS: Windows
  • Docs page last updated: May 14, 2026

Where the docs say RichRun.code

Two places on the styling page:

  1. Available selectors table:

    RichRun.code — Inline code spans. Background and monospace font.

  2. Custom styling example:

    <Style Selector="RichRun.code">
        <Setter Property="Background" Value="#e8f0fe" />
        <Setter Property="FontFamily" Value="Cascadia Code" />
    </Style>
    
    

To Reproduce

<Style Selector="RichRun.code">
    <Setter Property="Background" Value="#e8f0fe" />
    <Setter Property="FontFamily" Value="Cascadia Code" />
</Style>

Expected behavior

Expected vs. Actual
Expected: Following the docs, Style Selector="RichRun.code" styles inline code spans.
Actual: The selector matches zero elements. Inline code retains its default
appearance. Switching the selector to RichSpan.code works immediately.

Avalonia version

12.0.3

OS

Windows

Additional context

Suggested fix
Update the selector table entry and the custom-styling example from RichRun.code to
RichSpan.code:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions