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:14—render_spans()andrender_spans_with_refs()are the entry points- Add attribute detection at the line level before inline parsing:
- Check if the block text matches
^([^:]+):: (.+)$ - If yes: render key with attribute style, then parse value with normal inline parsing
- If no: proceed with normal parsing
- Check if the block text matches
- 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.rshas extensive test coverage — add tests for attribute parsing- Test: attribute with linked value, plain text value, empty value,
::inside code
Acceptance criteria
-
Key:: Valuerenders 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