This PR introduces the ability to concatenate output from multiple files, including support for base64-encoded images. This enhancement improves the functionality of the see command when redirecting output to a file, especially for markdown documents with embedded images.
Key Changes
Added base64 support to encode images in the output.
Modified the main function to handle image files differently when stdout is not a terminal.
Updated the render_image function to support base64-encoded image data.
Enhanced the ImageViewer to visualize both file paths and base64 image data.
Implementation Details
Added the base64 crate as a new dependency.
In main.rs, images are now encoded to base64 and output as markdown image tags when redirecting.
render.rs now includes logic to decode and render base64 image data.
viewers.rs has been updated to handle base64-encoded images in the ImageViewer.
Impact
These changes allow users to:
Concatenate multiple files, including images, into a single output file.
Generate markdown-compatible output with embedded base64 images.
View base64-encoded images directly in the terminal.
Example Usage
see file1.md image.png file2.md > output.md
This command will now produce a single markdown file with the content of file1.md, the image embedded as a base64-encoded markdown image tag, and the content of file2.md.
Summary
This PR introduces the ability to concatenate output from multiple files, including support for base64-encoded images. This enhancement improves the functionality of the
see
command when redirecting output to a file, especially for markdown documents with embedded images.Key Changes
render_image
function to support base64-encoded image data.ImageViewer
to visualize both file paths and base64 image data.Implementation Details
base64
crate as a new dependency.main.rs
, images are now encoded to base64 and output as markdown image tags when redirecting.render.rs
now includes logic to decode and render base64 image data.viewers.rs
has been updated to handle base64-encoded images in theImageViewer
.Impact
These changes allow users to:
Example Usage
This command will now produce a single markdown file with the content of
file1.md
, the image embedded as a base64-encoded markdown image tag, and the content offile2.md
.