PHPackages                             b13/codeblock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. b13/codeblock

ActiveTypo3-cms-extension[Utility &amp; Helpers](/categories/utility)

b13/codeblock
=============

Custom Content Type for code snippet elements to show text with code highlighting in TYPO3.

2.2.0(1w ago)511.5k↑16.8%7[1 issues](https://github.com/b13/codeblock/issues)[4 PRs](https://github.com/b13/codeblock/pulls)GPL-2.0-or-laterPHPPHP ^7.4 || ~8.0

Since Nov 8Pushed 1w ago6 watchersCompare

[ Source](https://github.com/b13/codeblock)[ Packagist](https://packagist.org/packages/b13/codeblock)[ Docs](https://github.com/b13/codeblock)[ RSS](/packages/b13-codeblock/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (6)Versions (19)Used By (0)

Code Block
==========

[](#code-block)

What does this extension do?
----------------------------

[](#what-does-this-extension-do)

Code Block is a TYPO3 extension. It adds a content type to display source code processed using `highlight.php` to render code snippets with syntax highlighting. The CSS-classes applied are identical to what highlight.js would render, but the transformation takes place on the server (instead of the browser when using JS).

The rendered result is cached like any other content element with the page in TYPO3. Using this extension you can skip adding highlight.js to your JS-build. This helps reduce the JavaScript size for your website and also allows rendering of source code snippets for AMP pages for example.

Code Languages
--------------

[](#code-languages)

The extension supports all code languages that highlight.php supports. These can either be specified by choosing a setting inside the content element or detected automatically.

Installation
------------

[](#installation)

Add this extension to your TYPO3 setup. Install using composer: `composer req b13/codeblock`.

Add the TypoScript to your site extensions setup:

`@import 'EXT:codeblock/Configuration/TypoScript/setup.typoscript'`

Add the PageTS (for adding the element to the New Content Element Wizard):

`@import 'EXT:codeblock/Configuration/PageTs/PageTs.tsconfig'`

If you want to use your own Fluid Template, add the Template Root Path to the setup like this:

`tt_content.codeblock.templateRootPaths.10 = EXT:your_site_extension/Resources/Private/Contenttypes/Templates`

### A note for Integrators:

[](#a-note-for-integrators)

If your Fluid Layout "Default" uses `` you should use a custom content type Fluid Template to avoid having your frontend tabs/spaces missing for some parts. `Spacelesse` removes spaces between tags, and `highlight.php` can add a series of `foo bar` strings that need the spaces between the tags to be readable and make sense.

Styles
------

[](#styles)

CSS styling needs to be included manually. The classes added to the HTML output are generated automatically. Their styling need to be specified in a CSS file in order to add a custom styling. E.g. for JetBrain's darcula theme:

```
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #2b2b2b;
}

.hljs {
  color: #bababa;
}

.hljs-strong,
.hljs-emphasis {
  color: #a8a8a2;
}

.hljs-bullet,
.hljs-quote,
.hljs-link,
.hljs-number,
.hljs-regexp,
.hljs-literal {
  color: #6896ba;
}

.hljs-code,
.hljs-selector-class {
  color: #a6e22e;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-section,
.hljs-attribute,
.hljs-name,
.hljs-variable {
  color: #cb7832;
}

.hljs-params {
  color: #b9b9b9;
}

.hljs-string {
  color: #6a8759;
}

.hljs-subst,
.hljs-type,
.hljs-built_in,
.hljs-builtin-name,
.hljs-symbol,
.hljs-selector-id,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-template-tag,
.hljs-template-variable,
.hljs-addition {
  color: #e0c46c;
}

.hljs-comment,
.hljs-deletion,
.hljs-meta {
  color: #7f7f7f;
}
```

This extension uses `highlight.php` (see ). This package includes [a lot of different CSS style themes](https://github.com/scrivo/highlight.php/tree/master/styles) you can use.

License
-------

[](#license)

As TYPO3 Core, *codeblock* is licensed under GPL2 or later. See the LICENSE file for more details.

Background, Authors &amp; Further Maintenance
---------------------------------------------

[](#background-authors--further-maintenance)

TYPO3 is highly configurable and it is easy to add custom content types to the system using a few lines of TCA configuration, a simple PageTS configuration to add the type to the list of elements in the New Content Element Wizard, and a few lines of TypoScript and a Fluid Template. This extension adds a content type in the same way we create custom content types for our TYPO3 projects at [b13](https://b13.com).

`EXT:codeblock` was initially created by Andreas Hämmerl and David Steeb in 2019 for [b13, Stuttgart](https://b13.com). We use it to display source code in our blog on [b13.com](https://b13.com), where we have a full-AMP website and do not include non-AMP JavaScript files.

[Find more TYPO3 extensions we have developed](https://b13.com/useful-typo3-extensions-from-b13-to-you) that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance94

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 79.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~186 days

Recently: every ~497 days

Total

14

Last Release

10d ago

Major Versions

v1.4.0 → 2.0.12023-01-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/165630?v=4)[Benni Mack](/maintainers/bmack)[@bmack](https://github.com/bmack)

![](https://avatars.githubusercontent.com/u/3862523?v=4)[David Steeb](/maintainers/davidsteeb)[@davidsteeb](https://github.com/davidsteeb)

---

Top Contributors

[![davidsteeb](https://avatars.githubusercontent.com/u/3862523?v=4)](https://github.com/davidsteeb "davidsteeb (68 commits)")[![bmack](https://avatars.githubusercontent.com/u/165630?v=4)](https://github.com/bmack "bmack (8 commits)")[![achimfritz](https://avatars.githubusercontent.com/u/2152991?v=4)](https://github.com/achimfritz "achimfritz (4 commits)")[![georgringer](https://avatars.githubusercontent.com/u/1905663?v=4)](https://github.com/georgringer "georgringer (2 commits)")[![o-ba](https://avatars.githubusercontent.com/u/8812114?v=4)](https://github.com/o-ba "o-ba (2 commits)")[![b13-michaelsemle](https://avatars.githubusercontent.com/u/23473071?v=4)](https://github.com/b13-michaelsemle "b13-michaelsemle (1 commits)")[![jschlier](https://avatars.githubusercontent.com/u/9108576?v=4)](https://github.com/jschlier "jschlier (1 commits)")

### Embed Badge

![Health badge](/badges/b13-codeblock/health.svg)

```
[![Health](https://phpackages.com/badges/b13-codeblock/health.svg)](https://phpackages.com/packages/b13-codeblock)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[wazum/sluggi

TYPO3 extension for URL slug management with inline editing, auto-sync, locking, access control, and redirects

40529.5k](/packages/wazum-sluggi)[typo3/cms-lowlevel

TYPO3 CMS Lowlevel - Technical analysis of the system. This includes raw database search, checking relations, counting pages and records etc.

178.2M318](/packages/typo3-cms-lowlevel)[typo3/cms-redirects

TYPO3 CMS Redirects - Create manual redirects, list existing redirects and automatically createredirects on slug changes.

167.4M80](/packages/typo3-cms-redirects)[typo3/cms-form

TYPO3 CMS Form - Flexible TYPO3 frontend form framework that comes with a backend editor interface.

147.6M266](/packages/typo3-cms-form)[derhansen/sf_event_mgt

Event management and registration - Configurable event management and registration extension based on ExtBase and Fluid

66338.4k10](/packages/derhansen-sf-event-mgt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
