Feature Request: Add ANSI Color Support (Terminal Logs) using @cookshack/codemirror-ansi (CM6 Extension)
Summary
I request the addition of support for ANSI escape sequences (terminal/console colors) within a designated code block language identifier (e.g., ansi or terminal). This will allow users to correctly view color-coded logs and terminal output in Obsidian's Live Preview (Reading not supported as it is done by Prism).
Basic example
The feature should integrate seamlessly with the existing external file referencing and line range selection features.
Desired Usage Syntax:
Example Log Snippet (Input Data containing ANSI codes):
[2025-10-16T11:07:33.932Z] [32mINFO[39m: Service started successfully.
[2025-10-16T11:07:33.990Z] 36c940a500da: [90mReading environment variables...[39;49;00m
[2025-10-16T11:07:34.110Z] [31mERROR[39m: Failed to connect to DB: connection timeout.
Expected Outcome (View Mode):
The text should display in the corresponding green, gray, and red colors, with the raw escape codes hidden.
Motivation
-
Enhancing Technical Notes: Logs and terminal outputs are critical for technical documentation, debugging, and post-mortems. Without ANSI support, these logs (which contain crucial color indicators like
ERRORin red orSUCCESSin green) are unreadable due to the visible raw escape sequences. -
Technical Solution (CM6): Since Obsidian's Live Preview is based on CodeMirror 6, a CM6-compatible extension is required. I recommend integrating the existing package:
@cookshack/codemirror-ansi(npm link:https://www.npmjs.com/package/@cookshack/codemirror-ansi), which should provide the necessary parsing and decoration logic.
Existing Requests?
I could not find an existing open feature request or pull request covering ANSI/terminal color support combined with file referencing.