Skip to content

feat: replace marked-terminal with custom terminal renderer - #696

Merged
avoidwork merged 5 commits into
mainfrom
feat/replace-marked-terminal-custom-renderer
Aug 8, 2026
Merged

feat: replace marked-terminal with custom terminal renderer#696
avoidwork merged 5 commits into
mainfrom
feat/replace-marked-terminal-custom-renderer

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

What

Replace the unmaintained marked-terminal dependency with a custom TerminalRenderer class extending marked.Renderer. Upgrades marked from 9.1.6 to 15.x, enabling security fixes and new markdown features.

Key Changes

  • src/tui/markdownText.js — Replaced markedTerminal() import with custom TerminalRenderer class implementing all renderer methods (headings, paragraphs, bold, italic, code blocks, links, lists, tables, blockquotes, task checkboxes, strikethrough, images, HR)
  • package.json — Removed marked-terminal, upgraded marked to ^15.0.0, added node-emoji and supports-hyperlinks as direct dependencies
  • package-lock.json — Updated dependency tree

Implementation Details

  • Uses chalk for ANSI styling (already transitive dependency)
  • Uses cli-highlight for code block syntax highlighting
  • Uses cli-table3 for table rendering
  • Uses node-emoji for :emoji-name: syntax support
  • Uses supports-hyperlinks + ansi-escapes for terminal hyperlinks
  • Implements ANSI-aware text reflow to terminal width
  • Supports hard/soft line breaks, HTML entity unescaping, colon escaping in code spans

Testing

  • All 1054 tests pass
  • Lint passes (0 errors, 10 warnings from legacy code patterns)
  • Application starts without crash

OpenSpec

Change: replace-marked-terminal-custom-renderer
See openspec/changes/replace-marked-terminal-custom-renderer/ for full proposal, design, specs, and tasks.

Replace marked-terminal with a custom TerminalRenderer extending
marked.Renderer. Add proposal, design, specs, and tasks for the
change.

See issue #595 for full details.
Replace the unmaintained marked-terminal dependency with a custom
TerminalRenderer class extending marked.Renderer. Upgrades marked from
9.1.6 to 15.x, enabling security fixes and new markdown features.

The custom renderer implements all markdown elements with ANSI styling
via chalk, syntax highlighting via cli-highlight, table rendering via
cli-table3, emoji support via node-emoji, and hyperlink support via
supports-hyperlinks.

BREAKING: Renders output uses different ANSI sequences than
marked-terminal. Visual output is parity-equivalent.
Archive the change and sync terminal-renderer spec delta to main.
Replace control character escapes with dynamic regex construction,
fix const reassignments in reflowText, remove unnecessary regex
escapes, and replace new Array(n) with Array.from({ length: n }).
@avoidwork
avoidwork merged commit 736b754 into main Aug 8, 2026
2 checks passed
@avoidwork
avoidwork deleted the feat/replace-marked-terminal-custom-renderer branch August 8, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant