@@ -21,17 +21,21 @@ Flashot is the **blazing-fast image generation tool** for code snippets, designe
2121
2222** Super fast:** (generated in ** ~ 135ms** )
2323
24- <img src =" ./test/.snapshot/demo.png " alt =" Example output " />
24+ <img src =" ./test/.snapshot/demo.webp " alt =" Example output " />
2525</div >
2626
2727## ✨ Features
2828
2929- 💻 ** Inline code support:** Easily convert inline code snippets to images
3030- 🌐 ** URL support:** Fetch code snippets directly from URLs
31- - 🎨 ** Customizable themes :** Choose from various themes to match your style
31+ - 🎨 ** Customizable styles :** Choose from various options to match your style
3232- 🖼️ ** High-quality output:** Generates crisp and clear images which keep the original code's formatting intact
3333- ⚡ ** Blazing fast:** Optimized for speed, ensuring quick image generation
34- - 🛠️ ** Flexible API:** Easy to integrate into your projects with a simple API
34+ - 🛠️ ** Easy to use:** Easy to integrate into your projects with a simple API
35+ - 🪓 ** Multi-format support:** Generate images in various formats (PNG, JPEG, WebP)
36+ - 🔷 ** TypeScript support:** Fully typed for better developer experience
37+ - 🔍 ** Extensive testing:** Thoroughly tested with a comprehensive suite of unit tests
38+ - 🔋 ** Easy integration:** Simple API for seamless integration into your projects
3539
3640## 📦 Installation
3741
@@ -88,10 +92,12 @@ Then you can use the `buffer` to display the image or send it in a response.
8892const defaultOptions = {
8993 lang: " ts" , // default is javascript
9094 theme: " ayu-dark" , // default is github-dark
91- font: " https://fonts.bunny.net/ubuntu-sans-mono/files/ubuntu-sans-mono-latin-400-normal.woff2" , // custom font
92- width: 800 , // default is auto
93- height: 400 , // default is auto
94- bg: " transparent" , // default is theme's background
95+ font: " https://fonts.bunny.net/ubuntu-sans-mono/files/ubuntu-sans-mono-latin-400-normal.woff2" , // default is bunny.net/jetbrains-mono.
96+ format: OutputFormat .Png , // default is OutputFormat.Webp, has three options: OutputFormat.Png, OutputFormat.Jpeg, OutputFormat.Webp
97+ quality: 100 , // default is 100 (1-100), only applies to JPEG formats
98+ width: 800 , // default is system's width
99+ height: 400 , // default is system's height
100+ bg: " transparent" , // default is system's background
95101 gap: 1 , // gap between lines (default is 1)
96102 style: {
97103 borderRadius: 10 , // default is 8
@@ -101,24 +107,26 @@ const defaultOptions = {
101107};
102108```
103109
104- | Option | Description | Default |
105- | -------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
106- | ` lang ` | Code language ([ supported] ( https://shiki.style/languages ) ) | ` "js" ` |
107- | ` theme ` | Rendering theme ([ supported] ( https://shiki.style/themes ) ) | ` "github-dark" ` |
108- | ` font ` | Font for rendering (URL or ArrayBuffer) | [ ` ubuntu ` ] ( https://fonts.bunny.net/ubuntu-sans-mono/files/ubuntu-sans-mono-latin-400-normal.woff2 ) |
109- | ` width ` | Image width | System default |
110- | ` height ` | Image height | System default |
111- | ` bg ` | Background color | Theme's background |
112- | ` gap ` | Gap between lines | ` 1 ` |
113- | ` style ` | Additional container styles ([ docs] ( https://takumi.kane.tw/docs/deep-dives/stylesheets ) ) | ` { borderRadius: 8, padding: 25 } ` |
110+ | Option | Description | Default |
111+ | --------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
112+ | ` lang ` | Code language ([ supported] ( https://shiki.style/languages ) ) | ` "js" ` |
113+ | ` theme ` | Rendering theme ([ supported] ( https://shiki.style/themes ) ) | ` "github-dark" ` |
114+ | ` font ` | Font for rendering (URL or ArrayBuffer) | [ ` Jetbrains Mono ` ] ( https://fonts.bunny.net/jetbrains-mono/files/jetbrains-mono-latin-400-normal.woff2 ) |
115+ | ` format ` | Output image format (` OutputFormat.Png ` , ` OutputFormat.Jpeg ` , ` OutputFormat.Webp ` ) | ` OutputFormat.Webp ` |
116+ | ` quality ` | Image quality (1-100) for JPEG formats | ` 100 ` |
117+ | ` width ` | Image width | System default |
118+ | ` height ` | Image height | System default |
119+ | ` bg ` | Background color | Theme's background |
120+ | ` gap ` | Gap between lines | ` 1 ` |
121+ | ` style ` | Additional container styles ([ docs] ( https://takumi.kane.tw/docs/deep-dives/stylesheets ) ) | ` { borderRadius: 8, padding: 25 } ` |
114122
115123## 📚 Technologies
116124
117125- ⚡ ** [ Bun] ( https://bun.sh ) ** - Fast all-in-one JavaScript runtime and toolkit
118126- 🏗️ ** [ TypeScript] ( https://www.typescriptlang.org/ ) ** - Type-safe development with strict mode enabled
119127- 📦 ** [ Vite] ( https://vitejs.dev/ ) ** - Lightning-fast build tool with optimized bundling
120- - 🔋 ** [ Vitest] ( https://vitest.dev/ ) ** - Blazing fast unit testing & interactive test UI framework
121- - 🪓 ** [ shiki] ( https://github.com/shikijs/shiki ) ** and ** [ takumi] ( https://github.com/kane50613/takumi ) **
128+ - 🧪 ** [ Vitest] ( https://vitest.dev/ ) ** - Blazing fast unit testing & interactive test UI framework
129+ - 🎨 ** [ shiki] ( https://github.com/shikijs/shiki ) ** and ** [ takumi] ( https://github.com/kane50613/takumi ) **
122130- 📝 ** [ Biome] ( https://biomejs.dev/ ) ** - Fast formatter and linter for consistent code style
123131- 🚀 ** Dual Module Support** - ESM and CommonJS output with proper type definitions
124132- 🔥 ** [ ESLint] ( https://eslint.org/ ) ** - Advanced linting with TypeScript and SonarJS rules
0 commit comments