avelino/roam-tui

Render attribute syntax (key:: value)

Open

#11 opened on Feb 25, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (0 forks)github user discovery
area: renderinggood first issuepriority: mediumroam parity

Repository metrics

Stars
 (21 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Summary

Render Roam's attribute syntax Key:: Value with visual distinction — the key portion styled differently from the value. Attributes are widely used in Roam for structured data (metadata, properties, fields).

Roam web behavior: Text before :: renders as a clickable attribute name (acts like a page link). Text after :: renders normally but the attribute name has distinct styling.

TUI adaptation: Render the key portion in bold with a distinct color (e.g., bold cyan or bold yellow). The value portion renders with normal inline markdown parsing (links, tags, etc. still work).

Implementation hints

Parser

  • src/markdown.rs:14render_spans() and render_spans_with_refs() are the entry points
  • Add attribute detection at the line level before inline parsing:
    1. Check if the block text matches ^([^:]+):: (.+)$
    2. If yes: render key with attribute style, then parse value with normal inline parsing
    3. If no: proceed with normal parsing
  • Important: :: can appear mid-block (e.g., after a TODO marker), so match from the first :: occurrence

Rendering

  • Key: bold + distinct color (e.g., Style::default().fg(Color::Cyan).add_modifier(Modifier::BOLD))
  • Separator ::: rendered as-is in dim style
  • Value: parsed with existing render_spans() for full inline markdown support

Examples

Input Rendered as
Author:: [[John]] Author:: [John] (cyan link)
Status:: {{TODO}} Status:: ☐
Tags:: #project, #active Tags:: #project, #active (cyan tags)
Source:: https://example.com Source:: https://example.com

Edge cases

  • Multiple :: in one block → only first occurrence is treated as attribute separator
  • :: inside code backticks → should NOT be treated as attribute
  • Empty value (Key::) → render key only

Tests

  • src/markdown.rs has extensive test coverage — add tests for attribute parsing
  • Test: attribute with linked value, plain text value, empty value, :: inside code

Acceptance criteria

  • Key:: Value renders with distinct key styling
  • Value portion supports full inline markdown (links, tags, code, etc.)
  • :: inside backtick code is not treated as attribute
  • Tests cover all edge cases

Contributor guide