{"_id":"emdash-plugin-highlightjs","_rev":"3-4c3ebb0dd1406c8db829f5acb8bafa6d","name":"emdash-plugin-highlightjs","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"emdash-plugin-highlightjs","version":"1.0.0","keywords":["emdash","emdash-plugin","highlightjs","syntax-highlighting","code-blocks","portable-text","cms"],"author":{"name":"Adriano Amalfi"},"license":"MIT","_id":"emdash-plugin-highlightjs@1.0.0","maintainers":[{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"}],"homepage":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs#readme","bugs":{"url":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs/issues"},"dist":{"shasum":"0eb9b41d9f7ce19a377e8c5f976bb7d921450db0","tarball":"https://registry.npmjs.org/emdash-plugin-highlightjs/-/emdash-plugin-highlightjs-1.0.0.tgz","fileCount":8,"integrity":"sha512-gg1gn4HPCwkspBrfw+XWRmAcCXA1wwObt1JmZOpxdz4V/wLWH8oqMGlcP3toDqwgrtqvH2B3UEC0cI52kT1UIQ==","signatures":[{"sig":"MEUCIQDwLHAC/WB7lxTsR3+nhFCyQS1x7ZpDPFnFz7ocpqQd0AIga2ZDKk3jGhmJvMnzXzhWkg3GbKglK2sWrlug0rYzoXo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19444},"type":"module","exports":{".":"./src/index.ts","./astro":"./src/astro/index.ts","./sandbox":"./src/sandbox-entry.ts"},"gitHead":"2780b9bdb14761284aace491186043d0a7a938ad","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"],"branches":["main"]},"scripts":{"test":"vitest run","version":"node -p \"require('./package.json').version\"","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"},"repository":{"url":"git+https://github.com/adrianoamalfi/emdash-plugin-highlightjs.git","type":"git"},"_npmVersion":"11.14.1","description":"Syntax highlighting for EmDash CMS using Highlight.js — 12 themes, auto dark/light mode, copy button, and a custom code block component for Portable Text.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"highlight.js":"^11.10.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","typescript":"^6.0.3","semantic-release":"^25.0.3","@semantic-release/git":"^10.0.1","@semantic-release/changelog":"^6.0.3"},"peerDependencies":{"emdash":"^0.12.0"},"_npmOperationalInternal":{"tmp":"tmp/emdash-plugin-highlightjs_1.0.0_1778739481582_0.28318599669875355","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"emdash-plugin-highlightjs","version":"1.0.1","keywords":["emdash","emdash-plugin","highlightjs","syntax-highlighting","code-blocks","portable-text","cms"],"author":{"url":"https://adrianoamalfi.com","name":"Adriano Amalfi","email":"adrianoamalfi@gmail.com"},"license":"MIT","_id":"emdash-plugin-highlightjs@1.0.1","maintainers":[{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"}],"homepage":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs#readme","bugs":{"url":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs/issues"},"dist":{"shasum":"038eb53e5aa86adc991df475915d81a7ba0624e1","tarball":"https://registry.npmjs.org/emdash-plugin-highlightjs/-/emdash-plugin-highlightjs-1.0.1.tgz","fileCount":8,"integrity":"sha512-GwYNxgUw3F/zo7b+oMr7fwfArp5nwQ9mJWVFepTN1Y1nbxZfC+Pf5xXFtCYY4CDhpw8lHDXUIsx4jvj/qzoWiA==","signatures":[{"sig":"MEUCIQCpjkgKoduH8Bke9XuF2R6Ugjt3kmNd/mRPHI2b0vMW7QIgQwAk6HxcG6nWImRwyd56Oi42voacWqxLAhweKWR1Gos=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15709},"type":"module","exports":{".":"./src/index.ts","./astro":"./src/astro/index.ts","./sandbox":"./src/sandbox-entry.ts"},"gitHead":"8316994539fd9a7d06c827573f65141269ca06b1","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"],"branches":["main"]},"scripts":{"test":"vitest run","version":"node -p \"require('./package.json').version\"","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"},"repository":{"url":"git+https://github.com/adrianoamalfi/emdash-plugin-highlightjs.git","type":"git"},"_npmVersion":"11.14.1","description":"Syntax highlighting for EmDash CMS using Highlight.js — 12 themes, auto dark/light mode, copy button, and a custom code block component for Portable Text.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"highlight.js":"^11.10.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.6","typescript":"^6.0.3","semantic-release":"^25.0.3","@semantic-release/git":"^10.0.1","@semantic-release/changelog":"^6.0.3"},"peerDependencies":{"emdash":"^0.12.0"},"_npmOperationalInternal":{"tmp":"tmp/emdash-plugin-highlightjs_1.0.1_1778740942544_0.6550982431251722","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"emdash-plugin-highlightjs","version":"1.0.2","description":"Syntax highlighting for EmDash CMS using Highlight.js — 12 themes, auto dark/light mode, copy button, and a custom code block component for Portable Text.","type":"module","license":"MIT","author":{"name":"Adriano Amalfi","email":"adrianoamalfi@gmail.com","url":"https://adrianoamalfi.com"},"repository":{"type":"git","url":"git+https://github.com/adrianoamalfi/emdash-plugin-highlightjs.git"},"keywords":["emdash","emdash-plugin","highlightjs","syntax-highlighting","code-blocks","portable-text","cms"],"exports":{".":"./src/index.ts","./sandbox":"./src/sandbox-entry.ts","./astro":"./src/astro/index.ts"},"scripts":{"typecheck":"tsc --noEmit","test":"vitest run","test:watch":"vitest","version":"node -p \"require('./package.json').version\""},"publishConfig":{"access":"public"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"]},"peerDependencies":{"emdash":"^0.12.0"},"dependencies":{"highlight.js":"^11.10.0"},"devDependencies":{"@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","semantic-release":"^25.0.3","typescript":"^6.0.3","vitest":"^4.1.6"},"gitHead":"0a9de29da1e1fff89737f807bd6fcfafe94dc92f","_id":"emdash-plugin-highlightjs@1.0.2","bugs":{"url":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs/issues"},"homepage":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs#readme","_nodeVersion":"22.22.2","_npmVersion":"11.14.1","dist":{"integrity":"sha512-ju1jNh8/9tCeFMv5Ly0x+RYcwbP5QkhBsVoOXaAv7Diy/k9dTI575zQ86Lto3S+kPtMv40jFllddVQufqWK/9A==","shasum":"95bba4c1c9404c9b3993cced5a0f68f0872572a0","tarball":"https://registry.npmjs.org/emdash-plugin-highlightjs/-/emdash-plugin-highlightjs-1.0.2.tgz","fileCount":8,"unpackedSize":16224,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCvlo0b9+7cRXSLNyPJOFqRVUlb6M2P0WjG4ChnfhFrngIhAMYAFyjCCWJS1EvLDczVPKyYVOsOAtm5qojU6j4Uwn1T"}]},"_npmUser":{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"},"directories":{},"maintainers":[{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-plugin-highlightjs_1.0.2_1778763949356_0.0025915144857684425"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T06:18:01.457Z","modified":"2026-05-14T13:05:49.642Z","1.0.0":"2026-05-14T06:18:01.710Z","1.0.1":"2026-05-14T06:42:22.695Z","1.0.2":"2026-05-14T13:05:49.514Z"},"bugs":{"url":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs/issues"},"author":{"name":"Adriano Amalfi","email":"adrianoamalfi@gmail.com","url":"https://adrianoamalfi.com"},"license":"MIT","homepage":"https://github.com/adrianoamalfi/emdash-plugin-highlightjs#readme","keywords":["emdash","emdash-plugin","highlightjs","syntax-highlighting","code-blocks","portable-text","cms"],"repository":{"type":"git","url":"git+https://github.com/adrianoamalfi/emdash-plugin-highlightjs.git"},"description":"Syntax highlighting for EmDash CMS using Highlight.js — 12 themes, auto dark/light mode, copy button, and a custom code block component for Portable Text.","maintainers":[{"name":"adrianoamalfi","email":"adrianoamalfi@gmail.com"}],"readme":"# emdash-plugin-highlightjs\n\n[![CI](https://github.com/adrianoamalfi/emdash-plugin-highlightjs/actions/workflows/ci.yml/badge.svg)](https://github.com/adrianoamalfi/emdash-plugin-highlightjs/actions/workflows/ci.yml)\n[![Security](https://github.com/adrianoamalfi/emdash-plugin-highlightjs/actions/workflows/security.yml/badge.svg)](https://github.com/adrianoamalfi/emdash-plugin-highlightjs/actions/workflows/security.yml)\n[![npm version](https://img.shields.io/npm/v/emdash-plugin-highlightjs)](https://www.npmjs.com/package/emdash-plugin-highlightjs)\n\nSyntax highlighting for [EmDash CMS](https://emdashcms.com) using [Highlight.js](https://highlightjs.org/). Features 12 themes, auto dark/light switching, a copy button, and a custom Portable Text code block component.\n\n## Features\n\n- **12 themes** — GitHub, Atom One, VS Code, A11Y, Stack Overflow, Tokyo Night, Rose Pine, Panda, Monokai, Dracula, Nord, Night Owl\n- **Auto dark/light** — Themes with both variants switch via `MutationObserver` on `<html>` class\n- **Copy button** — Optional floating copy button with \"Copied!\" feedback\n- **Portable Text block** — `Code.astro` component with language detection and filename support\n- **Admin settings** — Theme picker and copy button toggle at `/_emdash/admin`\n- **CSS caching** — Theme CSS read once and cached in memory\n- **Server-side highlighting** — No client JS cost for syntax highlighting\n\n## Installation\n\n```bash\nnpm install emdash-plugin-highlightjs\n```\n\n## Usage\n\nRegister the plugin in `astro.config.mjs`:\n\n```ts\nimport { highlightjsPlugin } from \"emdash-plugin-highlightjs\";\n\nexport default defineConfig({\n  integrations: [\n    emdash({\n      plugins: [highlightjsPlugin()],\n    }),\n  ],\n});\n```\n\nCSS and copy button are injected automatically on all public pages. `Code.astro` renders automatically for `code` blocks in Portable Text content.\n\n## How It Works\n\nThe plugin injects four fragments via the `page:fragments` hook:\n\n1. **Light CSS** (`<style id=\"hljs-l\">`) in `<head>`\n2. **Dark CSS** (`<style id=\"hljs-d\" disabled>`) in `<head>`\n3. **Theme toggle script** in `<head>` — `MutationObserver` on `<html>.class`\n4. **Copy button script** at `<body:end>`\n\nThe `Code.astro` component renders code server-side via `highlight.js` — no client-side highlighting overhead.\n\n## Admin Settings\n\nNavigate to `/_emdash/admin` → **Highlight.js**.\n\n| Field | Default | Description |\n|---|---|---|\n| Syntax Theme | `github` | Pick from 12 themes |\n| Show copy button | `true` | Toggle floating copy button |\n\n## Themes\n\n| Theme | Dark variant | Light variant |\n|---|---|---|\n| GitHub | `github-dark` | `github` |\n| Atom One | `atom-one-dark` | `atom-one-light` |\n| VS Code | `vs2015` | `vs` |\n| A11Y | `a11y-dark` | `a11y-light` |\n| Stack Overflow | `stackoverflow-dark` | `stackoverflow-light` |\n| Tokyo Night | `tokyo-night-dark` | `tokyo-night-light` |\n| Rose Pine | `rose-pine` | `rose-pine-dawn` |\n| Panda | `panda-syntax-dark` | `panda-syntax-light` |\n| Monokai | `monokai` | — |\n| Dracula | `dracula` | — |\n| Nord | `nord` | — |\n| Night Owl | `night-owl` | — |\n\nThemes with both variants switch automatically with your site's dark/light mode. Single-variant themes use the dark CSS only.\n\n## Development\n\n```bash\ngit clone https://github.com/adrianoamalfi/emdash-plugin-highlightjs.git\ncd emdash-plugin-highlightjs\nnpm install\nnpm run typecheck\nnpm test\n```\n\n## Versioning\n\nThis project follows [Semantic Versioning](https://semver.org/). Releases are automated via [semantic-release](https://github.com/semantic-release/semantic-release) — pushing `fix:`, `feat:`, or `BREAKING CHANGE:` commits to `main` triggers a release to npm and GitHub.\n\n## License\n\nMIT © Adriano Amalfi\n","readmeFilename":"README.md"}