guilhermeprokisch / see

A cute cat(1) for the terminal with advanced code viewing, Markdown rendering, 🌳 tree-sitter syntax highlighting, images view and more.
MIT License
202 stars 2 forks source link

feat: concat and image concat b64 #54

Closed guilhermeprokisch closed 1 month ago

guilhermeprokisch commented 1 month ago

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

  1. Added base64 support to encode images in the output.
  2. Modified the main function to handle image files differently when stdout is not a terminal.
  3. Updated the render_image function to support base64-encoded image data.
  4. Enhanced the ImageViewer to visualize both file paths and base64 image data.

Implementation Details

Impact

These changes allow users to:

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.