Strip Markdown formatting from text while preserving the content.
- Remove Markdown formatting syntax (headers, emphasis, lists, etc.)
- Process files or stdin
- Optional preservation of links and code blocks
- Fast and lightweight
- Cross-platform support
brew install daikw/tap/mdstripgo install github.com/daikw/mdstrip/cmd@latestDownload the latest release from the releases page.
Strip Markdown from a file:
mdstrip input.mdStrip Markdown from stdin:
echo "# Hello **world**" | mdstrip
# Output: Hello worldSave output to a file:
mdstrip input.md -o output.txt-o, --output: Output file (default: stdout)-l, --keep-links: Keep link URLs in output-c, --keep-code: Keep code block markers-V, --verbose: Enable verbose logging--version: Show version information
# Remove all Markdown formatting
echo "# Title\n**Bold** and *italic* text" | mdstrip
# Output: Title\nBold and italic text
# Keep links
echo "Visit [GitHub](https://github.com)" | mdstrip --keep-links
# Output: Visit GitHub (https://github.com)
# Process multiple files
for f in *.md; do mdstrip "$f" -o "${f%.md}.txt"; done- Headers (
# H1,## H2, etc.) - Emphasis (
**bold**,*italic*,__underline__) - Lists (
- item,* item,1. item) - Code blocks (
```code```) - Inline code (
`code`) - Links (
[text](url)) - Images (
) - Blockquotes (
> quote) - Horizontal rules (
---,***) - HTML tags
- Escape characters
- Go 1.22 or later
- Make (optional)
# Clone the repository
git clone https://github.com/daikw/mdstrip
cd mdstrip
# Download dependencies
make deps
# Build
make build
# Run tests
make test- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.
- Inspired by various Markdown stripping tools in the ecosystem
- Built with urfave/cli for CLI framework
- Uses goreleaser for releases