This module integrates the Ace code editor into Drupal, enabling syntax highlighting and advanced editing features for content fields and text areas. It also allows embedding code snippets with customizable styling and supports PHP console integration for development.
Ace is a code editor written in JavaScript: syntax highlighting, indentation, keyboard shortcuts, auto-completion, code folding, and find and replace with regular expressions. Try the demo.
This module brings Ace into Drupal as a text editor, a field widget, a field formatter, a text filter, and an API for embedding code snippets in content.
Installation
From 2.0.5 the module requires the Ace library itself. No Asset Packagist, no npm-asset installer path, no installers-extender.
composer require drupal/ace_editor:~2.0
drush en ace_editor
Composer installs vardot/ace at web/libraries/ace. Without Composer, put one build from ace-builds under /libraries/ace.
Features
Text editor
Go to /admin/config/content/formats, pick a text format, and choose Ace Editor as its text editor.
Field widget and formatter
On the form display, set a long text field to the Ace Editor widget. On Manage display, set it to Ace Format to render it read-only with syntax highlighting.
Code snippets in content
Add the Ace syntax highlighting filter to a text format, then wrap code in an <ace> tag. Attributes override the defaults:
<ace theme="twilight" height="200px" font-size="12pt" print-margin="1">SOME CODE</ace>
The README lists every attribute.
Requirements
Drupal 10.1, 11 or 12. For Drupal 7, use the 1.x branch.
Credits
Thanks to boaloysius for the initial Drupal 8 release.
Ask your assistant about Ace Code Editor
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- editor Drupal core
Required by
2 tracked projects depend on this one
- Seeds Editor 149 sites
- Gherkin Script 31 sites
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.0.6 | Stable | 10–11 | Sep 25, 2026 | ||
| 2.0.5 | Stable | 10–11 | Sep 2, 2026 | ||
| 2.0.4 | Stable | 10–11 | Aug 24, 2026 | ||
| 2.0.3 | Stable | 10–11 | Feb 1, 2026 | ||
| 2.0.2 | Stable | 10–11 | Jul 13, 2025 | ||
| 2.0.1 | Stable | 10–11 | Sep 9, 2024 | ||
| 2.0.0 | Stable | 10–11 | Jun 19, 2024 | ||
| 2.0.0-beta2 | Pre-release | 8–10 | Sep 23, 2023 | ||
| 2.0.0-beta1 | Pre-release | 8–10 | Aug 26, 2023 | ||
| 2.0.0-alpha1 | Pre-release | 8–10 | Jan 17, 2023 |