JavaScriptlanguage-js
// First N terms of the Fibonacci sequence
function fibonacci(n) {
const result = [0, 1];
for (let i = 2; i < n; i++) {
result.push(result[i - 1] + result[i - 2]);
}
return result;
}
const name = "JSRay";
const MAX_ITEMS = 100;
const pattern = /^[a-z]+$/i;
console.log(fibonacci(10));
TypeScriptlanguage-ts
/**
* Describes a user entity
*/
interface User {
id: number;
name: string;
role?: "admin" | "guest";
}
async function fetchUser(id: number): Promise<User> {
const res = await fetch(`/api/users/${id}`);
if (!res.ok) throw new Error("Not found");
return res.json();
}
Pythonlanguage-python
from dataclasses import dataclass
from typing import List
@dataclass
class Article:
title: str
tags: List[str]
views: int = 0
def popular(self) -> bool:
# Articles with more than 1,000 views are considered popular
return self.views > 1_000
if __name__ == "__main__":
a = Article(title="Hello", tags=["intro"], views=2048)
print(a.popular())
HTMLlanguage-html
<!-- Article card -->
<article class="card card--featured" data-id="42">
<h2 class="card__title">JSRay is live</h2>
<p>A <strong>zero-dependency</strong> code rendering kernel</p>
<a href="https://jsray.org" target="_blank">
Learn more →
</a>
</article>
CSSlanguage-css
/* Card component styles */
.card {
display: flex;
flex-direction: column;
padding: 24px;
background: #0A0B0E;
border-radius: 0.75rem;
transition: transform 200ms ease;
}
.card:hover {
transform: translateY(-2px);
}
@media (max-width: 640px) {
.card { padding: 16px; }
}
JSONlanguage-json
{
"name": "jsray",
"version": "1.0.0",
"description": "JavaScript-native code rendering kernel",
"license": "MIT",
"keywords": ["code-rendering", "themes", "developer-tools"],
"main": "jsray.js",
"private": true
}
Shelllanguage-bash
# Deploy script
set -euo pipefail
VERSION="1.0.0"
DIST_DIR="./dist"
if [ ! -d "$DIST_DIR" ]; then
mkdir -p "$DIST_DIR"
fi
echo "Building JSRay v$VERSION..."
cp jsray.{js,css} "$DIST_DIR/"
tar -czf "jsray-$VERSION.tgz" "$DIST_DIR"
echo "Done → jsray-$VERSION.tgz"
Markdownlanguage-md
# JSRay
A **zero-dependency** code rendering kernel supporting *35 language families*.
## Features
- Auto-scans `<pre><code>`
- Dual-theme toggle
- 23 token-class semantics
[View the demo](https://jsray.org)
> "Less is more." — Mies van der Rohe