|
| 1 | +# Introduction to CodeSnap |
| 2 | + |
| 3 | +Welcome to CodeSnap! This is a Rust-based tool for creating beautiful code snapshots quickly. It uses a direct graphics engine, eliminating the need for network or browser-based rendering. You can use it from the command line with our CLI tool or incorporate it into your project via our library. |
| 4 | + |
| 5 | +## Main Features |
| 6 | + |
| 7 | +<!-- - **⚡ Fast**: Built with Rust for quick snapshot generation. |
| 8 | +- **🖥️ CLI Tool**: Command-line interface for ease of use. |
| 9 | +- **📚 Library**: Easily integrates into projects as a library. |
| 10 | +- **🔢 Line Numbers**: Adds line numbers for better clarity. |
| 11 | +- **💧 Watermark**: Customize snapshots with personal watermarks. |
| 12 | +- **🎨 Themes**: Supports a variety of Sublime Text themes. |
| 13 | +- **🔍 Scale**: Adjustable scale factors for high-quality snapshots. |
| 14 | +- **🖼️ Custom Backgrounds**: Choose from solid or gradient backgrounds. |
| 15 | +- **📁 Multiple Formats**: Save snapshots in PNG, SVG, or HTML. |
| 16 | +- **📋 Clipboard Support**: Copy snapshots to and from the clipboard. |
| 17 | +- **🏷️ Breadcrumbs**: Share snapshots with code paths for traceability. --> |
| 18 | + |
| 19 | +### 🚀 Performance |
| 20 | +- **Fast**: Built with Rust, CodeSnap efficiently generates snapshots using its graphics engine for swift operations. |
| 21 | + |
| 22 | +### 📜 Versatility |
| 23 | +- **CLI Tool**: Create snapshots directly from the command line with ease. |
| 24 | +- **Library Integration**: Integrate CodeSnap into your projects to use its features within your development environment. |
| 25 | + |
| 26 | +### 📐 Customization |
| 27 | +- **Line Numbers**: Snapshots can include line numbers, helping to contextualize code snippets. |
| 28 | +- **Watermarks**: Add custom watermarks to your snapshots for personalization. |
| 29 | +- **Themes**: Supports Sublime Text syntax definitions, offering a variety of theme options. |
| 30 | + |
| 31 | +### 🖼️ Flexibility |
| 32 | +- **Scalability**: Adjust the scale factor for snapshots; high-quality outputs are the default. |
| 33 | +- **Backgrounds**: Choose from default or custom background colors for visual enhancement. |
| 34 | + |
| 35 | +### 📁 Formats & Clipboard |
| 36 | +- **Snapshot Formats**: Save snapshots in formats like PNG, SVG, HTML, or ASCII. |
| 37 | +- **Clipboard Integration**: Copy snapshots directly to or from the clipboard. |
| 38 | + |
| 39 | +### 🎯 Breadcrumbs |
| 40 | +- **Navigation**: Use CodeSnap's breadcrumb feature for easy attribution and code context sharing. |
| 41 | + |
| 42 | +## Quick Start |
| 43 | + |
| 44 | +### CLI Installation |
| 45 | + |
| 46 | +CodeSnap can be installed on various platforms: |
| 47 | + |
| 48 | +<details> |
| 49 | +<summary>Arch Linux</summary> |
| 50 | + |
| 51 | +```bash |
| 52 | +pacman -S codesnap |
| 53 | +``` |
| 54 | + |
| 55 | +</details> |
| 56 | + |
| 57 | +<details> |
| 58 | +<summary>Nix/NixOS</summary> |
| 59 | + |
| 60 | +```bash |
| 61 | +nix-env -i codesnap |
| 62 | +``` |
| 63 | + |
| 64 | +</details> |
| 65 | + |
| 66 | +<details> |
| 67 | +<summary>Cargo</summary> |
| 68 | + |
| 69 | +```bash |
| 70 | +cargo install codesnap-cli |
| 71 | +``` |
| 72 | + |
| 73 | +Or via precompiled binary: |
| 74 | + |
| 75 | +```bash |
| 76 | +cargo binstall codesnap-cli |
| 77 | +``` |
| 78 | + |
| 79 | +</details> |
| 80 | + |
| 81 | +<details> |
| 82 | +<summary>Homebrew</summary> |
| 83 | + |
| 84 | +```bash |
| 85 | +brew install mistricky/tap/CodeSnap |
| 86 | +``` |
| 87 | + |
| 88 | +</details> |
| 89 | + |
| 90 | +View our [Getting Started](/getting-started) page for more information. |
| 91 | + |
| 92 | +### Library Integration |
| 93 | + |
| 94 | +Add CodeSnap to your Cargo project with: |
| 95 | + |
| 96 | +```bash |
| 97 | +cargo add codesnap |
| 98 | +``` |
| 99 | + |
| 100 | +Build snapshots programmatically using: |
| 101 | + |
| 102 | +```rust |
| 103 | +let code_content = Content::Code( |
| 104 | + CodeBuilder::from_t |
| 105 | + .content(r#"print "Hello, World!""#) |
| 106 | + .language("python") |
| 107 | + .build()?, |
| 108 | +); |
| 109 | + |
| 110 | +let snapshot = CodeSnap::from_default_theme() |
| 111 | + .content(code_content) |
| 112 | + .build()? |
| 113 | + .create_snapshot()?; |
| 114 | + |
| 115 | +// Copy the snapshot data to the clipboard |
| 116 | +snapshot.raw_data()?.copy() |
| 117 | +``` |
| 118 | + |
| 119 | +Explore more by visiting the [Getting Started](/getting-started) page. |
0 commit comments