Public
Like
1
lines
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v41View latest version
This service generates Open Graph images for Val Town code snippets, making your code look great when shared on social media.
- Generates aesthetically pleasing code snippet images
- Supports both single lines and line ranges
- Automatically redirects to the original Val Town URL
- Preserves syntax formatting
- PNG format for maximum compatibility
- SVG format available for debugging
Simply use a URL in this format:
https://[this-service-url]/x/{username}/{project}/{filepath}?L={line}
When this URL is shared on platforms like Twitter, Slack, or Discord, it will display a beautiful code snippet image and redirect to the original Val Town URL.
This service uses:
- Satori - Vercel's library for generating SVG from HTML/CSS
- resvg_wasm - For converting SVG to PNG
- Inter font from Google Fonts
/x/stevekrouse/sqlite/main.tsx?L=10
/x/stevekrouse/sqlite/main.tsx?L=10-15
You can directly access images at:
/png/{username}/{project}/{filepath}?L={line} # PNG format (recommended)
/svg/{username}/{project}/{filepath}?L={line} # SVG format (for debugging)
- For best results, keep line ranges reasonably small (up to 10 lines)
- The service will automatically truncate very long snippets
- Works with any public Val Town code
- PNG images are used by default for better compatibility
- SVG images are available for debugging purposes
