[WordPress] 外掛分享: Lazy Syntax Highlighter

首頁 › 外掛目錄 › Lazy Syntax Highlighter
WordPress 外掛 Lazy Syntax Highlighter 的封面圖片
全新外掛
安裝啟用
—
尚無評分
5 天前
最後更新
—
問題解決
WordPress 6.3+ PHP 7.4+ v1.3.4 上架:2026-09-13

內容簡介

Lazy Syntax Highlighter 是一款用於在伺服器端高亮顯示程式碼的外掛,能有效減少前端載入的 JavaScript,並提供快速、無閃爍的顯示效果。它支援約 185 種語言,並提供多種主題選擇,適合需要程式碼高亮的網站。

【主要功能】
• 伺服器端高亮顯示程式碼,無需前端 JavaScript
• 支援約 185 種語言及五種主題
• 自動快取已渲染的 HTML,提高效能
• 提供行號、行高亮及折疊功能
• 編輯器內即時語法高亮,並可一鍵猜測語言
• 安全移除,不會影響現有內容

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Lazy Syntax Highlighter」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Lazy Syntax Highlighter highlights code on the server, once, and caches the result. Your visitors download a couple of kilobytes of CSS and no JavaScript at all. There is no flash of unstyled code, nothing to wait for, and nothing to break when a script fails to load.
Free forever core — server-side rendering, caching, around 185 languages, all five themes, and the full Enlighter compatibility layer are in the free plugin. No block cap, no watermark.
Migrating from Enlighter?
Since WordPress 6.3 moved the post editor into an iframe, Enlighter blocks can render unstyled while you’re writing them — and if you have hundreds of posts already using it, rewriting them all isn’t realistic.
Install Lazy Syntax Highlighter and your existing Enlighter blocks render correctly again immediately, automatically — on the front end and in the editor. Nothing is written to your database. Not one post is modified. Deactivate the plugin and your posts are exactly as they were.
That is not a trial feature. It is in the free plugin, permanently.
Safe to remove, too. Uninstalling Lazy Syntax Highlighter converts every block it created back into a standard WordPress Code block, and the compatibility layers never wrote anything to begin with — so you are never locked in, and removing the plugin never leaves your site broken.
What you get

A code block that highlights on the server — the HTML arrives already coloured, with no front-end JavaScript
Rendered HTML cached in its own database table, warmed automatically when you save a post
Five hand-tuned themes, every token colour checked for WCAG AA contrast
Line numbers, line highlighting, a starting line number, and a hover effect
Multi-line folding — collapse line ranges behind a summary row, with no front-end JavaScript
Inline highlighting — a toolbar button that colours a run of code inside a sentence
Syntax highlighting while you type, right in the block editor, with a one-click language guess
A header bar — none, or the macOS “headlights” dots — plus site-wide font, size, line-height, corner and padding controls
An optional copy-to-clipboard button — about 1 KB, deferred, and loaded only on pages that use it
Tab-to-space conversion, so indentation looks the same in every browser
Around 185 languages, with PHP, JavaScript, Python, PowerShell, Bash, HTML, CSS, SQL, JSON and YAML given the most attention
Code in comments, using Enlighter’s shortcode syntax — existing Enlighter comments keep working untouched
WordPress’s own Code blocks are picked up too, so every code block on the site looks the same without touching a single post

Fast by construction

Nothing is enqueued on pages without a code block. No CSS, no JavaScript, nothing.
Highlighting never runs on a cache hit.
Only the one grammar a block actually needs is loaded, not all 185.
The cache lives in its own table, never in the autoloaded options blob.
If you run Redis or Memcached, a cache hit never touches the database at all.
Output is identical for every visitor, so full-page caches and CDNs cache it normally.
No webfonts. No external requests. Ever.

Why Lazy Syntax Highlighter
Lazy Syntax Highlighter is built and used daily on a real site — not a feature checklist assembled to compete on paper. If you would rather not ship a highlighting engine to every visitor’s browser, or you want your existing Enlighter blocks converted automatically instead of by hand, that is exactly what this is for.
The free plugin is actively maintained and stays that way. There is a paid add-on, Lazy Syntax Highlighter Pro, but it is built on top of the free plugin — every fix and language improvement lands in the free version first.
It is the second plugin in the Lazy family, alongside LazyLink, and shares the same rules: vanilla PHP and core WordPress APIs, no third-party services, and nothing phoning home.
Lazy Syntax Highlighter Pro
Lazy Syntax Highlighter Pro is an optional paid add-on that installs alongside the free plugin. Same render engine, same zero front-end JavaScript — the extra themes are CSS, the long-code toggle is CSS, and the Enlighter migration runs on the command line. It adds:

19 more themes, 24 in total — Nord, Dracula, Tokyo Night, Solarized, Gruvbox, Night Owl and eleven of VS Code’s own
Three more header-bar styles — muted headlights, a language label, and a language pill with optional custom text per block
Reader-friendly long code — collapse long snippets behind a “show more” button, with a site-wide line threshold and a per-block override, still with no front-end JavaScript
A site-wide default language, and a per-post default, so you are not setting the language on every block
wp lsh migrate — convert every Enlighter block on the site to a native block permanently, with a dry run and a full rollback
Priority email support

Details and pricing: https://syntax.lazyadmin.nl
Pro is entirely optional. Nothing in the free plugin is time-limited, capped or watermarked, and if a Pro licence ever lapses every block simply falls back to the free plugin’s styling — your posts are never touched, and any blocks already migrated stay converted.
Privacy
This plugin makes no external HTTP requests, loads no fonts or scripts from third parties, and collects nothing.

延伸相關外掛

文章
Filter
Mastodon