vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Fix HTMX inline styles and Prism worker message parsing
ac00929fcb2269e874a0b7c0e6868885f57723ce · Keenan Nemetz · 12d ago · parent a76b2f38
Fix HTMX inline styles and Prism worker message parsing HTMX injects a <style> element for its indicator classes, which style-src 'self' blocks. Turn that off through its config meta tag and keep the indicator rules in the stylesheet instead. Prism installs its own worker message handler that expects a JSON string, so it threw JSON.parse on every structured job before prism-worker.js could highlight it. Disable that handler; the worker already owns the message path.
server/web/highlight_test.go +15
| @@ -44,6 +44,21 @@ func TestPrismLanguageNamesKnownFiles(t *testing.T) { | |||
| 44 | 44 | } | |
| 45 | 45 | } | |
| 46 | 46 | ||
| 47 | // The worker installs its own message handler and posts structured objects. Prism | ||
| 48 | // installs one too when it finds a WorkerGlobalScope, and that one expects a JSON | ||
| 49 | // string, so leaving it on throws JSON.parse on every job before the worker's | ||
| 50 | // handler runs. | ||
| 51 | func TestPrismWorkerDisablesPrismOwnMessageHandler(t *testing.T) { | ||
| 52 | t.Parallel() | ||
| 53 | source, err := os.ReadFile("static/prism-worker.js") | ||
| 54 | if err != nil { | ||
| 55 | t.Fatal(err) | ||
| 56 | } | ||
| 57 | if !strings.Contains(string(source), "disableWorkerMessageHandler: true") { | ||
| 58 | t.Fatal("prism-worker.js lets Prism parse the worker's structured messages as JSON") | ||
| 59 | } | ||
| 60 | } | ||
| 61 | |||
| 47 | 62 | // TestPrismLanguagesAreVendored holds the server's table to the worker's bundle. | |
| 48 | 63 | // A name here with no grammar there colours nothing, and nothing fails at build | |
| 49 | 64 | // time; the blob just quietly stays plain. | |