Title: Syntax-highlighting Code Block (with Server-side Rendering)
Author: Weston Ruter
Published: <strong>Agẹmọ  30, 2019</strong>
Last modified: Èbìbí  19, 2026

---

Ṣàwárí àwọn plugin

![](https://ps.w.org/syntax-highlighting-code-block/assets/banner-772x250.png?rev
=3406002)

![](https://ps.w.org/syntax-highlighting-code-block/assets/icon.svg?rev=3406002)

# Syntax-highlighting Code Block (with Server-side Rendering)

 Láti ọwọ́ [Weston Ruter](https://profiles.wordpress.org/westonruter/)

[Ṣe ìgbàsílẹ̀](https://downloads.wordpress.org/plugin/syntax-highlighting-code-block.1.5.2.zip)

 * [Àwọn àlàyé](https://yor.wordpress.org/plugins/syntax-highlighting-code-block/#description)
 * [Àwọn àgbéyẹ̀wò](https://yor.wordpress.org/plugins/syntax-highlighting-code-block/#reviews)
 * [Ìdàgbàsókè](https://yor.wordpress.org/plugins/syntax-highlighting-code-block/#developers)

 [Ìrànlọ́wọ́](https://wordpress.org/support/plugin/syntax-highlighting-code-block/)

## Àpèjúwe

This plugin extends the Code block in WordPress core to add syntax highlighting 
which is rendered on the server. Pre-existing Code blocks on a site are automatically
extended to include syntax highlighting. Doing server-side syntax highlighting eliminates
the need to enqueue any JavaScript on the frontend (e.g. Highlight.js or Prism.js)
and this ensures there is no flash of unhighlighted code (FOUC?). Reducing script
on the frontend improves frontend performance, and it also allows for the syntax
highlighted code to appear properly in AMP pages as rendered by the [official AMP plugin](https://amp-wp.org)(
see also [ampproject/amp-wp#972](https://github.com/ampproject/amp-wp/issues/972))
or when JavaScript is turned off in the browser.

This extended Code block uses language auto-detection to add syntax highlighting,
but you can override the language in the blockÌtumọ̀ Yorùbá: ’s settings sidebar.(
There is currently no syntax highlighting of the Code block in the editor, but see
[#8](https://github.com/westonruter/syntax-highlighting-code-block/issues/8).) The
plugin supports all [programming languages](https://highlightjs.org/static/demo/)
that [highlight.php](https://github.com/scrivo/highlight.php) supports (being a 
port of [highlight.js](https://highlightjs.org/)). The Code block also is extended
to support specifying lines to highlight which get marked up with `mark` elements(
including in RSS feeds). There is also a checkbox for whether to show line numbers
on the frontend (with the numbers being non-selectable). Lastly, given inconsistencies
across themes regarding whether lines in a Code block should be wrapped, this plugin
adds styling to force them to no-wrap by default, with a checkbox to opt in to wrapping
when desired.

For advanced usage, please see the [plugin wiki](https://github.com/westonruter/syntax-highlighting-code-block/wiki).

This plugin is [developed on GitHub](https://github.com/westonruter/syntax-highlighting-code-block).
See [list of current issues](https://github.com/westonruter/syntax-highlighting-code-block/issues)
with the plugin. Please feel free to file any additional issues or requests that
you may come across. [Pull requests](https://github.com/westonruter/syntax-highlighting-code-block/pulls)
are welcome. See [contributing information](https://github.com/westonruter/syntax-highlighting-code-block/wiki/Contributing).

#### Credits

This is a fork of [Code Syntax Block](https://github.com/mkaz/code-syntax-block)
by [Marcus Kazmierczak](https://mkaz.blog/) (mkaz), which is also [available on WordPress.org](https://wordpress.org/plugins/code-syntax-block/).
Copyright (c) 2018 Marcus Kazmierczak. Licensed under GPL 2.0 or later.

[highlight.php](https://github.com/scrivo/highlight.php) is released under the BSD
3-Clause License. Copyright © 2006-2013, Ivan Sagalaev (maniac@softwaremaniacs.org),
highlight.js (original author). Copyright © 2013, Geert Bergman (geert@scrivo.nl),
highlight.php

## Àwọn àwòrán ìbòjú

 * [[
 * Code blocks can be added as normal, optionally overriding the auto-detected language.
   Also specify any lines to be highlighted, whether to show line numbers, and if
   the lines should wrap.
 * [[
 * The Code block renders with syntax highlighting on the frontend without any JavaScript
   enqueued. Stylesheets are added only when block is on the page.

## Àwọn àgbéyẹ̀wò

![](https://secure.gravatar.com/avatar/81d6cd29d711b1b8f768e3f31b7493de331a70168494303d83b73c2dbeca125c?
s=60&d=retro&r=g)

### 󠀁[code block is not 100% of wp users bro](https://wordpress.org/support/topic/code-block-is-not-100-of-wp-users-bro/)󠁿

 [audioscavenger](https://profiles.wordpress.org/audioscavenger/) Igbe 11, 2024

no one wants to conduct a real study to see how many of use hate the code block.

![](https://secure.gravatar.com/avatar/8a93e92ac024cb0f2b659dc8fd82d168193e82f0fd94ba830f79ae69f3bbc96e?
s=60&d=retro&r=g)

### 󠀁[Very good job!](https://wordpress.org/support/topic/very-good-job-83/)󠁿

 [Salvatore Noschese](https://profiles.wordpress.org/salvatorenoschese/) Òkúdù 3,
2023 1 ìdáhùn

missed just a download and/or copy button. also for theme, maybe is best to update“
usage instruction”! only after some search I understood can be changed via customized
menu. anyway, looks so good. ty.

![](https://secure.gravatar.com/avatar/6ac7c2e9bb1e43d09d87b780c06c09b391a52680c3b1512bcd094176376a1a26?
s=60&d=retro&r=g)

### 󠀁[This works nicely.](https://wordpress.org/support/topic/this-works-nicely/)󠁿

 [OllieJones](https://profiles.wordpress.org/olliejones/) Èbìbí 25, 2023

Thanks for this. ItÌtumọ̀ Yorùbá: ’s really nice.

![](https://secure.gravatar.com/avatar/5c6cbac107c132c57a2bb2d7a5f8b0c31d899519c58ea4b22f62eb718541afce?
s=60&d=retro&r=g)

### 󠀁[Nice plugin, thank you !](https://wordpress.org/support/topic/nice-plugin-thank-you-16/)󠁿

 [Marie Comet](https://profiles.wordpress.org/chaton666/) Bélú 4, 2022

Works great, thanks !

![](https://secure.gravatar.com/avatar/fc29a040754a796607f46a128e6b54e53d1491994ec3326df3ef015c23bb8f37?
s=60&d=retro&r=g)

### 󠀁[ItÌtumọ̀ Yorùbá: ’s time to switch to get more performance!](https://wordpress.org/support/topic/its-time-to-switch-to-get-more-performance/)󠁿

 [Gwyneth Llewelyn](https://profiles.wordpress.org/gwynethllewelyn/) Agẹmọ 13, 2022
1 ìdáhùn

I confess, IÌtumọ̀ Yorùbá: ’ve been a happy user of Code Syntax Block for quite 
a while — a plugin which the author, Weston Router, clearly states that Syntax Highlighting(
Code Block) is based upon. Alas, however, all the pages I had with the older plugin
would suffer from an inevitable rendering slowdown — there is so much Javascript
on web pages these days that such a slowdown is inevitable, and this is especially
true to those scripts that attempt to recognise the language automatically — something
that will consume plenty of CPU cycles on the browser. Parsing the language is also
no mean feature by itself (I know, IÌtumọ̀ Yorùbá: ’ve been doing some experiments
for some code editors, and, believe me, itÌtumọ̀ Yorùbá: ’s tough!). So why force
the end-user to bear the burden of all that work? It makes much more sense to pre-
render everything on the server, and then let the web server send the already-parsed
HTML from its cache. That way, the end-user will already have everything on their
browser, no need to wait for parsing! Also, if you ‘forget’ to set the language 
that your code is in (it happens…), the auto-detecting feature will only run on 
the server, and just once, when you save the post youÌtumọ̀ Yorùbá: ’re writing.
Even if it takes a fraction of a second more to save, think of how much time all
those users will save when they get the already-rendered page! So, this plugin is
definitely recommended. As a bonus: if you are already using some sort of code block
on your WP setup, once you turn off whatever plugin you were using, Syntax Highlighting(
Code Block) will immediately pick it up and start its magic (you might need to open
and save all the pages youÌtumọ̀ Yorùbá: ’ve got code on, though — IÌtumọ̀ Yorùbá:’
m not quite sure if thatÌtumọ̀ Yorùbá: ’s really the case). That means zero effort(
beyond saving) — what you already had will continue to work. And, naturally enough,
when you disable this plugin, your code block will just revert to the internal WP
code block instead — nothing will be ‘lost’ that way! If youÌtumọ̀ Yorùbá: ’re still
hesitant and reading this to the end… while you wasted your time here, think of 
how many of your users would have saved their time if you already had this plugin
installed 🙂

![](https://secure.gravatar.com/avatar/32d51f2a4043c936cd42663e3917116ce03a1b8f8d128e5df657e40aa3941716?
s=60&d=retro&r=g)

### 󠀁[Muy bueno!](https://wordpress.org/support/topic/muy-bueno-752/)󠁿

 [diegoamorin](https://profiles.wordpress.org/diegoamorin/) Igbe 19, 2022

No agrega bloques nuevos a WordPress, ya que potencia el bloque de código existente.
Soporta gran cantidad de Lenguajes, puedes mostrar líneas y marcar ciertas partes
del código. ¡Vaya todo lo que necesito! Y no hay que configurar nada!

 [ Ka gbogbo àwọn àgbéyẹ̀wò 26 ](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/)

## Àwọn Olùkópa & Olùgbéejáde

“Syntax-highlighting Code Block (with Server-side Rendering)” jẹ́ ètò ìṣàmúlò orísun
ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe ìkópa sí plugin yìí.

Àwọn Olùkópa

 *   [ Weston Ruter ](https://profiles.wordpress.org/westonruter/)
 *   [ Vladimir Jimenez ](https://profiles.wordpress.org/allejo/)

A ti túmọ̀ “Syntax-highlighting Code Block (with Server-side Rendering)” sí àwọn
èdè agbègbè 9. Ọpẹ́lọpẹ́ fún [àwọn atúmọ̀ èdè](https://translate.wordpress.org/projects/wp-plugins/syntax-highlighting-code-block/contributors)
fún àwọn ìkópa wọn.

[Túmọ̀ “Syntax-highlighting Code Block (with Server-side Rendering)” sí èdè rẹ.](https://translate.wordpress.org/projects/wp-plugins/syntax-highlighting-code-block)

### Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

[Ṣàwárí koodu](https://plugins.trac.wordpress.org/browser/syntax-highlighting-code-block/),
ṣàyẹ̀wò [ibi ìpamọ́ SVN](https://plugins.svn.wordpress.org/syntax-highlighting-code-block/),
tàbí ṣe àgbékalẹ̀ sí [àkọsílẹ̀ ìdàgbàsókè](https://plugins.trac.wordpress.org/log/syntax-highlighting-code-block/)
nípasẹ̀ [RSS](https://plugins.trac.wordpress.org/log/syntax-highlighting-code-block/?limit=100&mode=stop_on_copy&format=rss).

## Àkọsílẹ̀ àwọn àyípadà

For the plugin’s changelog, please see [the Releases page on GitHub](https://github.com/westonruter/syntax-highlighting-code-block/releases).

## Àkójọpọ̀ Meta

 *  Ẹ̀yà **1.5.2**
 *  Ìgbàgbọ́hùn tó kẹ́yìn **ọ̀sẹ̀ 1 sẹ́yìn**
 *  Àwọn ìgbéwọlẹ̀ tó ṣiṣẹ́ **1,000+**
 *  Ẹ̀yà WordPress ** 6.6 tàbí ju bẹ́ẹ̀ lọ **
 *  Dánwò dé **7.0**
 *  Ẹ̀yà PHP ** 7.4 tàbí ju bẹ́ẹ̀ lọ **
 *  Àwọn èdè
 * [English (US)](https://wordpress.org/plugins/syntax-highlighting-code-block/),
   [French (France)](https://fr.wordpress.org/plugins/syntax-highlighting-code-block/),
   [German](https://de.wordpress.org/plugins/syntax-highlighting-code-block/), [German (Switzerland)](https://de-ch.wordpress.org/plugins/syntax-highlighting-code-block/),
   [Norwegian (Bokmål)](https://nb.wordpress.org/plugins/syntax-highlighting-code-block/),
   [Spanish (Chile)](https://cl.wordpress.org/plugins/syntax-highlighting-code-block/),
   [Spanish (Colombia)](https://es-co.wordpress.org/plugins/syntax-highlighting-code-block/),
   [Spanish (Mexico)](https://es-mx.wordpress.org/plugins/syntax-highlighting-code-block/),
   [Spanish (Spain)](https://es.wordpress.org/plugins/syntax-highlighting-code-block/),
   àti [Spanish (Venezuela)](https://ve.wordpress.org/plugins/syntax-highlighting-code-block/).
 *  [Túmọ̀ sí èdè rẹ](https://translate.wordpress.org/projects/wp-plugins/syntax-highlighting-code-block)
 * Àwọn àmì
 * [block](https://yor.wordpress.org/plugins/tags/block/)[code](https://yor.wordpress.org/plugins/tags/code/)
   [code highlighting](https://yor.wordpress.org/plugins/tags/code-highlighting/)
   [code syntax](https://yor.wordpress.org/plugins/tags/code-syntax/)[syntax highlight](https://yor.wordpress.org/plugins/tags/syntax-highlight/)
 *  [Ìwòye Tó Péye](https://yor.wordpress.org/plugins/syntax-highlighting-code-block/advanced/)

## Àwọn ìbò

 5 lára àwọn ìràwọ̀ 5.

 *  [  26 5-star reviews     ](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/syntax-highlighting-code-block/reviews/)

## Àwọn Olùkópa

 *   [ Weston Ruter ](https://profiles.wordpress.org/westonruter/)
 *   [ Vladimir Jimenez ](https://profiles.wordpress.org/allejo/)

## Ìrànlọ́wọ́

Nǹkan wà tí o fẹ́ sọ? Ṣé o nílò ìrànlọ́wọ́?

 [Wo àpéjọ ìrànlọ́wọ́](https://wordpress.org/support/plugin/syntax-highlighting-code-block/)