Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module integrates highlight.php into Drupal to automatically highlight code blocks within your content. It allows you to render code snippets with proper syntax highlighting by wrapping them in `<code>` tags.

Summary

Provides highlight.php integration to Drupal, allowing <code> blocks to be automatically highlighted with the correct language. highlight.php is a code syntax highlighter port of highlight.js.

Installation

  1. Run composer require drupal/highlight_php and enable the highlight_php module.
  2. Configure a text format (admin/config/content/formats/manage/*) and enable the "Highlight <code> tags in HTML." filter
  3. Add <code> blocks in CKEditor and watch them get auto-highlighted! See scrivo/highlight.php on GitHub for more documentation on expected behavior.

You can also switch to the manual highlighting mode for more accurate language detection. To switch modes, visit /admin/config/content/highlight-php

Notes

All code tags that have a recognizable language will be automatically processed and styled by this filter. If you want to display code inline, please use a pre tag.

Activity

Total releases
2
First release
Dec 2024
Latest release
1 month ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Release date
1.1.x-dev Dev Jun 11, 2026
1.0.4 Stable Dec 8, 2024