Skip to content

feat: large ASCII-art headings in view mode #197

@oobagi

Description

@oobagi

Problem

Headings in view mode are just bold text — they don't feel visually distinct or impactful. mdfried-style large titles would make view mode feel more like a polished reading experience.

Context

View mode renders H1/H2/H3 as plain styled text via lipgloss in renderViewBlock() (internal/editor/render.go:713-723). Heading styles are defined in internal/theme/theme.go as HeadingStyle{Text: TextStyle{Bold, Italic, Color, ...}}. View mode centers content within viewMaxWidth = 72 (internal/editor/editor.go:258).

mdfried uses Kitty text sizing protocol or cosmic-text rasterization, but both require terminal graphics protocol support. For a Go/Bubble Tea app, figlet-style ASCII art is the practical approach — works in all terminals, no protocol detection needed, and fits the aesthetic.

Go libraries: github.com/common-nighthawk/go-figure or github.com/lukesampson/figlet for FIGlet font rendering.

Key files:

  • internal/editor/render.gorenderViewBlock() (lines 692-808), heading render cases
  • internal/theme/theme.goHeadingStyle struct, theme presets
  • internal/editor/editor.goviewMaxWidth constant, view mode logic

Approach

Use a Go FIGlet library to render H1 text as multi-line ASCII art in view mode only. H2/H3 stay as styled text (large ASCII art for all heading levels would be noisy).

  • Add a FIGlet font field to HeadingStyle (e.g., ArtFont string) so themes can pick their own font (or disable with empty string)
  • In renderViewBlock(), detect H1 + non-empty ArtFont → render via figlet instead of plain text
  • Center the ASCII art output within viewMaxWidth
  • Edit mode stays unchanged — ASCII art headings are a view-mode-only enhancement
  • Truncate or fall back to plain text if the ASCII art exceeds terminal width

Tasks

  • Add a Go FIGlet dependency (evaluate go-figure vs figlet vs vendoring a minimal implementation)
  • Add ArtFont string field to HeadingStyle in internal/theme/theme.go
  • Set default FIGlet fonts for H1 across theme presets (pick fonts that match each theme's personality)
  • Update renderViewBlock() in internal/editor/render.go to render H1 as ASCII art when ArtFont is set
  • Handle edge cases: long titles that overflow width, empty content, narrow terminals
  • Ensure ASCII art respects theme accent color

Acceptance criteria

  • H1 blocks render as multi-line ASCII art in view mode
  • Each theme can specify its own FIGlet font (or disable with empty string)
  • Edit mode rendering is unchanged
  • ASCII art is centered within the view mode content area
  • Graceful fallback for titles too wide for the terminal

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions