CodeBlock
moleculesDependency-free chrome around code: language or filename header, copy button, line numbers, soft wrap, height cap and collapse, with your own highlighter or pre-rendered HTML.
Route loader
highlight is your function (code, lang) => HTML; class-based output (hljs-*, Prism) is themed by the --syn-* tokens. filename titles the block, showLineNumbers adds the gutter.
import { error } from '@sveltejs/kit';
import { getService } from '#lib/server/fleet.js';
export async function load({ params }) {
const service = await getService(params.name);
if (!service) error(404, 'Unknown service');
// cpu is sampled every 15 seconds
return { service, refreshMs: 15000, live: true };
}Header and chrome
Plain code with no header extras, a lang label, a filename, copy={false} for read-only output.
npm install @dorsk/tsumikitgit clone https://github.com/DorskFR/tsumikit.git
cd tsumikit
npm install
npm run dev -- --opengit clone https://github.com/DorskFR/tsumikit.git
cd tsumikit
npm install
npm run dev -- --open✓ 412 tests passed (3.2s)
✓ build ok (dist/ 184 kB)Long content
A long line scrolls inside the block by default or soft-wraps with wrap; breakAll splits unbroken secrets; maxHeight caps the body and collapsible turns the cap into a Show more toggle.
kubectl -n cyberia logs deploy/api-gateway --since=1h --timestamps --all-containers --prefix | grep -E "5[0-9]{2}" | tail -n 200kubectl -n cyberia logs deploy/api-gateway --since=1h --timestamps --all-containers --prefix | grep -E "5[0-9]{2}" | tail -n 200GITHUB_TOKEN=ghp_9f12e485513e4d6eb987d81a95cead559f12e485513e4d6eb987d81a95cead55export const fleet = {
api-gateway-0: { replicas: 1, region: 'eu-west-1' },
worker-02-1: { replicas: 2, region: 'eu-west-1' },
cache-01-2: { replicas: 3, region: 'eu-west-1' },
postgres-primary-3: { replicas: 1, region: 'eu-west-1' },
api-gateway-4: { replicas: 2, region: 'eu-west-1' },
worker-02-5: { replicas: 3, region: 'eu-west-1' },
cache-01-6: { replicas: 1, region: 'eu-west-1' },
postgres-primary-7: { replicas: 2, region: 'eu-west-1' },
api-gateway-8: { replicas: 3, region: 'eu-west-1' },
worker-02-9: { replicas: 1, region: 'eu-west-1' },
cache-01-10: { replicas: 2, region: 'eu-west-1' },
postgres-primary-11: { replicas: 3, region: 'eu-west-1' },
api-gateway-12: { replicas: 1, region: 'eu-west-1' },
worker-02-13: { replicas: 2, region: 'eu-west-1' },
cache-01-14: { replicas: 3, region: 'eu-west-1' },
postgres-primary-15: { replicas: 1, region: 'eu-west-1' },
api-gateway-16: { replicas: 2, region: 'eu-west-1' },
worker-02-17: { replicas: 3, region: 'eu-west-1' },
cache-01-18: { replicas: 1, region: 'eu-west-1' },
postgres-primary-19: { replicas: 2, region: 'eu-west-1' },
api-gateway-20: { replicas: 3, region: 'eu-west-1' },
worker-02-21: { replicas: 1, region: 'eu-west-1' },
cache-01-22: { replicas: 2, region: 'eu-west-1' },
postgres-primary-23: { replicas: 3, region: 'eu-west-1' },
};export const fleet = {
api-gateway-0: { replicas: 1, region: 'eu-west-1' },
worker-02-1: { replicas: 2, region: 'eu-west-1' },
cache-01-2: { replicas: 3, region: 'eu-west-1' },
postgres-primary-3: { replicas: 1, region: 'eu-west-1' },
api-gateway-4: { replicas: 2, region: 'eu-west-1' },
worker-02-5: { replicas: 3, region: 'eu-west-1' },
cache-01-6: { replicas: 1, region: 'eu-west-1' },
postgres-primary-7: { replicas: 2, region: 'eu-west-1' },
api-gateway-8: { replicas: 3, region: 'eu-west-1' },
worker-02-9: { replicas: 1, region: 'eu-west-1' },
cache-01-10: { replicas: 2, region: 'eu-west-1' },
postgres-primary-11: { replicas: 3, region: 'eu-west-1' },
api-gateway-12: { replicas: 1, region: 'eu-west-1' },
worker-02-13: { replicas: 2, region: 'eu-west-1' },
cache-01-14: { replicas: 3, region: 'eu-west-1' },
postgres-primary-15: { replicas: 1, region: 'eu-west-1' },
api-gateway-16: { replicas: 2, region: 'eu-west-1' },
worker-02-17: { replicas: 3, region: 'eu-west-1' },
cache-01-18: { replicas: 1, region: 'eu-west-1' },
postgres-primary-19: { replicas: 2, region: 'eu-west-1' },
api-gateway-20: { replicas: 3, region: 'eu-west-1' },
worker-02-21: { replicas: 1, region: 'eu-west-1' },
cache-01-22: { replicas: 2, region: 'eu-west-1' },
postgres-primary-23: { replicas: 3, region: 'eu-west-1' },
};Bring your own highlighter
Three inputs, cheapest first: plain code (escaped), a highlight callback, or pre-rendered html from a build step (html wins; code stays the copy source).
const ready = await probe('api-gateway', { timeout: 3000 });
if (!ready) return null;const ready = await probe('api-gateway', { timeout: 3000 });
if (!ready) return null;const ready = await probe('api-gateway', { timeout: 3000 });
if (!ready) return null;Props
| Prop | Type | Default | Description |
|---|---|---|---|
code required | string | — | |
lang | string | — | Language label (and hint passed to `highlight`). |
html | HTMLValue | — | Pre-highlighted HTML (overrides `highlight`). MUST be trusted or sanitized: tsumikit does not sanitize it unless `sanitize` is set. |
highlight | (code: string, lang?: string) => HTMLValue | — | Highlighter callback returning HTML for `code`; same trust rule as `html`. |
sanitize | boolean | SanitizeOptions | — | Sanitize `html` / `highlight` output client-side: `setHTML` where supported, else `fallback`. |
filename | string | — | |
showLineNumbers | boolean | false | |
wrap | boolean | false | |
copy | boolean | true | |
maxHeight | string | — | Cap the body height; scrolls past it (or expands when `collapsible`). |
collapsible | boolean | false | With `maxHeight`, a toggle in the header expands the body instead of scrolling. |
expandLabel | string | 'Show more' | |
collapseLabel | string | 'Show less' | |
breakAll | boolean | false | Break long unbroken strings (secrets, hashes) anywhere. |
class | string | '' |