This Oh My Zsh plugin combines the contents of multiple files into a single markdown document, supporting syntax highlighting based on file extensions. If an output file is not specified, the script copies the content to the clipboard, making it easy to paste anywhere.
- Combines multiple files into one markdown document.
- Automatically adds syntax highlighting based on the file extension.
- Option to copy combined content to the clipboard if no output file is specified.
- Z shell (zsh)
pbcopy
command available (for clipboard functionality, macOS default, use alternatives likexclip
orclip.exe
for Linux and Windows)
To use the script, run it from the command line, providing the files you wish to combine as arguments. You can optionally specify an output file using the -o
flag.
to_markdown [-o output_file] file1 [file2 ...]
To install this script as a custom plugin for Oh My Zsh:
- Copy this plugin directory into the
custom/plugins
directory of your Oh My Zsh installation. The default directory is:
git clone [email protected]:sbolel/.dotfiles.git
cd .dotfiles
cp -r .oh-my-zsh/custom/plugins/to_markdown ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/to_markdown
- Add
to_markdown
to the list of plugins in your .zshrc file. Find the line that starts withplugins=
and add to_markdown to the list of plugins to be loaded.
plugins=(... to_markdown)
- Reload your shell configuration to apply the changes:
source ~/.zshrc
- To combine
LICENSE
andpackage.json
and copy the result to the clipboard:
to_markdown ./LICENSE ./package.json
- To combine
README.md
andCONTRIBUTING.md
into a file namedcombined.md
:
to_markdown -o combined.md ./README.md ./CONTRIBUTING.md