README
¶
colored-md
A CLI filter for rendering Markdown files with syntax highlighting and formatting directly in your terminal.
It's built on top of the charmbracelet/glamour library, providing a simple wrapper to bring rich, colored Markdown output to your CLI workflows.
SYNOPSIS:
echo -e "# Hello World\nThis is **bold** text." | colored-md
OPTIONS:
- -h, --help Display help message
- -m, --man Display full readme
- -v, --version Display version information (tip: colored-md --version | jq -r .Version)
- -s, --styles List supported styles
FEATURES
- Renders Markdown to ANSI-colored terminal output
- Customizable output width via
GLAMOUR_WIDTHenvironment variable - Customizable style via
GLAMOUR_STYLEenvironment variable - Supports overriding styling defaults
- Processes both piped input and specified file paths
- Supports executable markdown files with shebangs
- Autodetects dark/light terminal mode
EXAMPLE SCREENSHOT

INSTALLATION
To install colored-md:
go install github.com/andrew-grechkin/colored-md@latest
USAGE
Piping input
You can pipe Markdown content directly to colored-md:
echo -e "# Hello World\nThis is **bold** text." | colored-md
Processing files
Specify one or more Markdown files as arguments:
colored-md README.md my_document.md
To read from standard input while also processing files, use - as a filename:
cat my_file.md | colored-md - README.md
Executable markdown files
Make markdown files directly executable by adding a shebang:
#!/usr/bin/env -S colored-md
# My Document
Content here...
Then make the file executable and run it:
chmod +x document.md
./document.md
The shebang line will be automatically stripped from the rendered output. See example/executable.md for a working example.
Customize output width
Set the GLAMOUR_WIDTH environment variable to control the word wrap width:
GLAMOUR_WIDTH=80 colored-md README.md
Customize margins
GLAMOUR_OVERRIDE_MARGIN=2 colored-md README.md
GLAMOUR_OVERRIDE_MARGIN_CODE=8 colored-md README.md
Styling
Set the GLAMOUR_STYLE environment variable to control the style:
GLAMOUR_STYLE=dracula colored-md README.md
Every style has following overrides:
- Document prefix and suffix new line is removed
- Undesired margin of 2 spaces on the left side of the whole document
- Code margin is removed
MOTIVATION
Why colored-md over glow?
While glow is a popular Markdown renderer, colored-md was created to address specific shortcomings when used as a CLI filter:
- Undesired directory traversal:
glowhas functionality to traverse directories and find Markdown files, which is often not desired when simply piping content or processing specific files - Forced paging in pipelines:
glowtends to force paging (e.g., usingless) even when used in pipelines, which can disrupt CLI workflows where direct output is expected - Overrides in styles:
glowuses styles provided by glamour as is, as described above these styles have undesired margins and paddings - Shebang support: Self executable markdown files are not supported
colored-md aims to be a simpler, more predictable CLI filter for Markdown rendering and nothing more, following
strictly UNIX philosophy.
AUTHOR
- Andrew Grechkin
LICENSE
This project is licensed under the GNU General Public License Version 2 (GPLv2).
See the LICENSE file for details.
Documentation
¶
There is no documentation for this package.