drupal - 如何在 Drupal 6 编辑器中突出显示 PHP 代码?

标签 drupal drupal-6 tinymce syntax-highlighting wysiwyg

我一直在寻找一个具有语法突出显示功能的优秀编辑器,用于在 drupal 6 节点主体中使用 php 代码。

我想先澄清一件事,我不需要为节点中“发布”或“显示”的代码添加语法高亮。但我需要为某些页面编写 php 代码把它们写得像文本一样,没有任何突出显示,是非常烦人的。

正如你在下面看到的,我想要 php 语法 <?php echo "Hello world"; ?>要突出显示。

enter image description here

我尝试了很多组合,但没有找到我真正想要的东西。 以下是我尝试过的一些事情...

I tried TinyMCE with codemagic, codemirror, editarea. But nothing really works as they should. adding to the above, trying to write and preserve code in any wysiwyg editor is a real pain in the a**.

Then I tried colorer module but am facing many problems and not even a single bug report and issue of this module is fixed.

那么有没有办法将 php 代码编写为代码而不是 drupal 节点内的文本..? 或者是没有人关心它,因为几乎没有人在节点内编写 php 代码..? 我希望不是唯一的一个,并且确实存在一些解决方案。

最佳答案

ACE editor作为 <textarea> 的代码编辑器效果非常好s,并且它有一个 Drupal 模块。 ACE 维护得很好,所以我会检查它们作为 colorer、TinyMCE 等的替代品。

编辑:但是,它仅适用于 Drupal 7,这没有帮助...

关于drupal - 如何在 Drupal 6 编辑器中突出显示 PHP 代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9347288/

相关文章:

javascript - tinymce:禁止在插入的标签内打字和偏移光标

postgresql - Drupal 与 Docker 中的 Postgres : throws exception after install

drupal - 在 drupal 7 中将表单元素添加到节点以供用户输入

drupal - theme($hook, $variables = array()) 以及它在 Drupal 7 中的工作原理

drupal - Nginx + php5-fpm + Drupal : 404 "File not found"

php - 添加附件到 Jira 的 api

mysql - Drupal 6 如何与 MySQL 进行连接和事务交互?

drupal - 将日期数组保存到数据库

javascript - TinyMCE 不适用于第二个初始化

javascript - tinymce 自定义实现 - 他们的 docAPI 可能会更好