我一直在寻找一个具有语法突出显示功能的优秀编辑器,用于在 drupal 6 节点主体中使用 php 代码。
我想先澄清一件事,我不需要为节点中“发布”或“显示”的代码添加语法高亮。但我需要为某些页面编写 php 代码把它们写得像文本一样,没有任何突出显示,是非常烦人的。
正如你在下面看到的,我想要 php 语法 <?php echo "Hello world"; ?>
要突出显示。
我尝试了很多组合,但没有找到我真正想要的东西。 以下是我尝试过的一些事情...
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/