{"_id":"@masonjames/emdash-syntax-highlighter","name":"@masonjames/emdash-syntax-highlighter","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@masonjames/emdash-syntax-highlighter","version":"0.1.1","description":"Portable Text syntax highlighting for EmDash CMS with SSR rendering, line numbers, highlighted lines, and copy-to-clipboard.","type":"module","main":"src/index.ts","packageManager":"pnpm@10.0.0","exports":{".":"./src/index.ts","./plugin":"./src/plugin.ts","./astro":"./src/astro/index.ts"},"scripts":{"check":"pnpm typecheck && pnpm test","test":"vitest run","typecheck":"astro check && tsc --noEmit","prepublishOnly":"pnpm check"},"keywords":["emdash","cms","plugin","syntax-highlighting","code-blocks","shiki","portable-text"],"author":{"name":"Mason James"},"license":"MIT","publishConfig":{"access":"public","provenance":true},"peerDependencies":{"astro":">=6.0.0-beta.0","emdash":">=0.1.0"},"dependencies":{"@emdash-cms/blocks":"^0.1.0","shiki":"^3.12.2"},"devDependencies":{"@astrojs/check":"^0.9.4","@types/node":"^22.15.3","astro":"^6.0.0","typescript":"^5.8.3","vitest":"^4.0.0"},"repository":{"type":"git","url":"git+https://github.com/masonjames/emdash-syntax-highlighter.git"},"homepage":"https://github.com/masonjames/emdash-syntax-highlighter","bugs":{"url":"https://github.com/masonjames/emdash-syntax-highlighter/issues"},"gitHead":"76173e2fda561e2aaba14d5ef6ca7794903ed7dc","_id":"@masonjames/emdash-syntax-highlighter@0.1.1","_nodeVersion":"25.8.2","_npmVersion":"11.11.1","dist":{"integrity":"sha512-2nyksJknaZmnwD25SLXgCWUvPEELoFgDfwVHOqx5j6H8/DhiMct614uqWjcoLOWQzjgNvq9DWakIXWvWNVe9xQ==","shasum":"3a3c0c49da31bc1457e4e96f741f98b76f303d96","tarball":"https://registry.npmjs.org/@masonjames/emdash-syntax-highlighter/-/emdash-syntax-highlighter-0.1.1.tgz","fileCount":18,"unpackedSize":36111,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGp5/IU648JkoTzXgsVDjOjiHnpKKevQEYuDQuO6uykNAiBG83vKmSq8owQmc4OeMU6/3GnwrBg+kyUF+kgPAJxr6A=="}]},"_npmUser":{"name":"masonjames","email":"masonjames@gmail.com"},"directories":{},"maintainers":[{"name":"masonjames","email":"masonjames@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-syntax-highlighter_0.1.1_1775182935461_0.0465397053316412"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T02:22:15.391Z","0.1.1":"2026-04-03T02:22:15.623Z","modified":"2026-04-03T02:22:15.803Z"},"maintainers":[{"name":"masonjames","email":"masonjames@gmail.com"}],"description":"Portable Text syntax highlighting for EmDash CMS with SSR rendering, line numbers, highlighted lines, and copy-to-clipboard.","homepage":"https://github.com/masonjames/emdash-syntax-highlighter","keywords":["emdash","cms","plugin","syntax-highlighting","code-blocks","shiki","portable-text"],"repository":{"type":"git","url":"git+https://github.com/masonjames/emdash-syntax-highlighter.git"},"author":{"name":"Mason James"},"bugs":{"url":"https://github.com/masonjames/emdash-syntax-highlighter/issues"},"license":"MIT","readme":"# EmDash Syntax Highlighter\n\nFirst-class code snippets for EmDash CMS.\n\n`@masonjames/emdash-syntax-highlighter` adds a dedicated `syntaxCode` Portable Text block with:\n\n- server-rendered syntax highlighting via Shiki\n- sitewide defaults for theme, line numbers, copy buttons, and collapse behavior\n- per-block override controls with true “inherit site default” behavior\n- highlighted-line support (`2,4-6`)\n- graceful fallback to plain text for unsupported or disallowed languages\n- progressive copy-to-clipboard enhancement with no runtime network dependency\n\n## Why this is a trusted/native plugin\n\nEmDash currently requires a **native/trusted plugin** for the combination of:\n\n- `admin.portableTextBlocks`\n- `componentsEntry` SSR block rendering\n\nThat means this package installs through `plugins: []` in your EmDash config, not via the sandboxed marketplace flow.\n\nIf EmDash adds marketplace support for Portable Text blocks in the future, a marketplace variant could exist. Today, the supported path is trusted npm installation via `astro.config.mjs`.\n\n## Installation\n\n```bash\npnpm add @masonjames/emdash-syntax-highlighter\n```\n\n## Usage\n\n```ts\n// astro.config.mjs\nimport { defineConfig } from \"astro/config\";\nimport emdash from \"emdash/astro\";\nimport { syntaxHighlighterPlugin } from \"@masonjames/emdash-syntax-highlighter\";\n\nexport default defineConfig({\n\tintegrations: [\n\t\temdash({\n\t\t\tplugins: [syntaxHighlighterPlugin()],\n\t\t}),\n\t],\n});\n```\n\nOnce installed, editors can insert **Code Snippet** from the Portable Text slash menu.\n\n## Sitewide settings\n\nThe auto-generated plugin settings screen includes:\n\n- **Syntax theme**\n- **Show line numbers by default**\n- **Show copy button by default**\n- **Allowed languages**\n- **Collapse long snippets by default**\n- **Max lines before a snippet is considered long**\n\n### Allowed languages\n\nThe `Allowed languages` setting accepts comma-separated or newline-separated IDs and aliases, for example:\n\n```text\nts\ntsx\njs\njson\nbash\npython\nastro\n```\n\nLeaving it blank allows all bundled languages:\n\n- text\n- bash\n- javascript\n- typescript\n- jsx\n- tsx\n- json\n- yaml\n- html\n- css\n- markdown\n- astro\n- diff\n- python\n- go\n- rust\n- sql\n\n## Per-block fields\n\nEach `syntaxCode` block supports:\n\n- **Code**\n- **Language**\n- **Title**\n- **Highlight lines**\n- **Line numbers** (`inherit`, `show`, `hide`)\n- **Copy button** (`inherit`, `show`, `hide`)\n- **Collapsed by default** (`inherit`, `collapsed`, `expanded`)\n\nThe tri-state controls are intentional: they let a block inherit the latest sitewide default instead of flattening “inherit” and “false” into the same value.\n\n## Rendering behavior\n\n- Base highlighting is rendered on the server.\n- Unsupported or disallowed languages safely fall back to plain text.\n- Copy uses the Clipboard API when available and stays hidden otherwise.\n- Line numbers are rendered with CSS pseudo-elements so copied text stays clean.\n\n## Development\n\n```bash\npnpm install\npnpm typecheck\npnpm test\n```\n\n## Release notes\n\n- **Distribution:** trusted npm package + GitHub repository\n- **Execution model:** trusted/native EmDash plugin\n- **Network access:** none required\n- **Routes/storage:** none in v1\n\n## Repository\n\n- GitHub: https://github.com/masonjames/emdash-syntax-highlighter\n","readmeFilename":"README.md","_rev":"1-d13223e368bd9b1ff6c6ce91e4ee71ab"}