A syntax-highlighting playground built with WebSharper and the WebSharper.HighlightJS bindings: pick a language, edit the snippet, and highlight.js colorizes it as you type.
- A language switcher that swaps in a sample snippet for F#, JavaScript, C#, Python, TypeScript, HTML, JSON, CSS, SQL and Shell.
- Live re-highlighting on every keystroke, using
Hljs.HighlightElement. - The core build of highlight.js with just the languages we use registered via
Hljs.RegisterLanguage.
src/Client.fskeeps the current language and source inVars; the output is acodeelement whose class islanguage-<id>and which is re-highlighted on every update.src/wwwroot/index.htmlholds the page header, and highlight.js is bundled from npm by esbuild.
dotnet run --project src
Then open http://localhost:5369.
dotnet build src/HighlightJS.fsproj -c Release
Every push to master builds in Release and publishes src/wwwroot to the
gh-pages branch via .github/workflows/deploy.yml.
