Linux 软件免费装
Banner图

Kodosvet Code Block

开发者 kotophalk
更新时间 2026年8月26日 06:02
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

gutenberg code developer syntax highlighting code block

下载

1.1.0

详情介绍:

Kodosvet Code Block is a zero-bloat Gutenberg block for displaying code with syntax highlighting powered by Highlight.js. Key Features: Migrator Tool: Navigate to Tools → Kodosvet Code Block to scan your site for legacy code blocks and migrate them to the modern Kodosvet format with a before/after preview.

安装:

  1. Upload the kodosvet-code-block folder to /wp-content/plugins/.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. In the Block Editor, search for "Kodosvet" to insert a code block.
  4. Configure default theme and color palette under Tools → Kodosvet Code Block.

屏幕截图:

  • Block editor: the block selected, Language and Title settings in the sidebar.
  • Tools → Kodosvet Code Block: scan results of the legacy block migrator.
  • Light mode with line numbers turned on — one click switches every block on the page.
  • Migrator preview modal: original `core/code` markup vs. the converted `stodum/code-block`.

升级注意事项:

1.1.0 Plugin renamed to Kodosvet Code Block for the WordPress.org directory. No data migration needed; existing blocks keep working. 1.0.9 Plugin Check clean-up before WordPress.org submission, migrator preview title fix, prefixed Highlight.js handles. Safe to upgrade. 1.0.8 Highlight.js is now bundled locally — no more external CDN requests. Safe to upgrade; no data migration needed. 1.0.7 Important fixes: block alignment support (wide/full), migration now creates revisions for safe rollback, all UI strings are now translatable.

常见问题:

Does this plugin require any build tools?

No. Kodosvet Code Block ships as vanilla JavaScript and CSS — no Node.js, webpack, or build step required.

How does the language auto-detection work?

The plugin uses a multi-layer approach:

  1. Explicit language selection in block settings (highest priority).
  2. Markdown fence detection (```language).
  3. First-line language markers.
  4. Smart heuristics for PHP, Bash, JavaScript, SQL, and other languages.
  5. Highlight.js auto-detection (with Swift Guard to prevent false positives).

Can I migrate my existing code blocks?

Yes! Go to Tools → Kodosvet Code Block and click Scan Posts. The migrator will find all posts with core/code or core/preformatted blocks and let you preview and migrate them individually or in bulk.

Does migration create revisions?

Yes. The migrator uses wp_update_post(), so WordPress creates a revision for each migrated post. You can roll back through the standard Revisions interface.

What happens when I delete the plugin?

The plugin removes its settings (theme preference and color palette) from the database. Your code block content remains in the posts as Gutenberg block comments.

更新日志:

1.1.0 1.0.9 1.0.8 1.0.7 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0