Readme

Highlight

This val exposes and endpoint that you can post code to and get back syntax highlighted html via Shiki. Shiki does server side highlighting, so it's perfect for val.town. You can switch themes by providing ?theme=<theme> and specify the language via ?lang=<language>

Example

You can play with a working example here.

const res = await fetch(`https://just_be-highlight.web.val.run?lang=${lang}&theme=${theme}`, { method: "POST", body: code, }); console.log(await res.text())

Why?

I want to add syntax highlighting to my blog soon and I'm experimenting with what it mean to offload parts of my rendering to val.town (behind a content-addressible cache, of course).

Code
HTTP
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
just_be-highlight.web.val.run
Updated: October 6, 2024