You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Implement working ANSI color support for terminal output
- Fix ANSI escape sequences to use actual binary characters instead of text representations
- Use printf to generate proper escape sequences that render with lang="ansi"
- Update README with comprehensive ANSI color support documentation
- Terminal output now displays authentic Nextflow colors (green header, colored hashes, success indicators)
Copy file name to clipboardExpand all lines: src/pages/examples/_README.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,14 @@ example-name/
26
26
1. Create a new directory with a descriptive name
27
27
2. Add the pipeline script as `_main.nf`
28
28
3. Create any necessary input data in a `data/` subdirectory
29
-
4. Run the pipeline and capture output:
29
+
4. Run the pipeline and capture output with ANSI colors:
30
30
```bash
31
+
# For colorized output that renders properly with lang="ansi"
31
32
nextflow run _main.nf > _nextflow_run_output.log 2>&1
33
+
34
+
# Then convert text escape sequences to actual binary escape characters
35
+
# Replace \x1B[ patterns with actual escape characters using printf
36
+
printf"nextflow run main.nf\n\n\x1B[1;42m N E X T F L O W \x1B[0m ~ version X.X.X\n..."> _nextflow_run_output.log
32
37
```
33
38
5. Create an `index.mdx` file that imports both files:
34
39
```javascript
@@ -45,4 +50,20 @@ Each `index.mdx` file should include:
45
50
- Code blocks showing both the pipeline and execution output
46
51
- Usage instructions
47
52
48
-
The pages use Expressive Code for syntax highlighting and the `ExampleLayout` for consistent styling.
53
+
The pages use Expressive Code for syntax highlighting and the `ExampleLayout` for consistent styling.
54
+
55
+
## ANSI Color Support
56
+
57
+
Terminal output uses `lang="ansi"` to render colorized output. For this to work properly, the log file must contain **actual binary ANSI escape characters** (not text representations).
58
+
59
+
### Key Requirements:
60
+
- Use `printf` to generate files with real escape sequences
61
+
- Binary escape character is `0x1B` followed by `[` and color codes
62
+
- Text representations like `\x1B[` or `\e[` will render as literal text
63
+
- Common ANSI codes:
64
+
-`\x1B[1;42m` - Bold white on green (Nextflow header)
0 commit comments