Alekhya is sanskrit word which means image in english
Prototype for generating code images from text using Shiki and Nuxt 4. As a USP it allows you to retrieve code snippet as PNG image via API call thanks to pi0/shiki-image.
Node
import { Buffer } from 'node:buffer'
const code = 'console.log("Hello World!")'
const encoded = Buffer.from(code).toString('base64')JavaScript (Browser)
const code = 'console.log("Hello World!")'
const encoded = btoa(
new TextEncoder().encode(code).reduce(
(data, byte) => data + String.fromCharCode(byte),
''
)
)Python
import base64
code = 'console.log("Hello World!")'
encoded = base64.b64encode(code.encode()).decode()Other
take raw code → convert to bytes → encode as Base64
https://getalekhya.netlify.app/api/image/code?code=<encodedCode>&lang=<yourLang>
Use any of your preferred tools to make API call to above URL
code: The base64 encoded code to generate an image for.lang: The programming language of the code (e.g., js, python). (View all Supported languages)theme: The theme to use for the code image (e.g., dracula, github). (View all Supported themes)
- You can generate code snippet in your build pipeline or automation
- Directly render various code snippets as image in your docs
- Add PR for your ideas 😜
- Code image generator
- Allow downloading, copying images in various formats
- Add UI like editor window
- more...
- [-] Provide API to retrieve code images
- API with basic features
- Allow UI customization
Proudly powered by Nuxt 4 ✨