Drupal 7.10 所见即所得,带语法高亮

发布于 2024-12-27 09:21:45 字数 1095 浏览 6 评论 0原文

有没有人有确认/测试工作方式来设置丰富的所见即所得(如CKEditor或TinyMCE)并支持语法突出显示(用于粘贴)并在 Drupal 7.10 中共享 java/php/etc.)?

我现在已经尝试了多种组合,并且一直在努力让它们在 Drupal 7.10 中工作。 这是我尝试过的:

  1. CKEditor (3.6.2) 使用带有语法荧光笔库的 CKEditor 模块 (7.x-1.6) 和 语法荧光笔模块 (7x-1.1)。我关注了 betuts.com/guide-install-syntax-highlighter-ckeditorckeditor-syntax-highlighter-plugin-drupal-7

    问题:我无法将代码按钮添加到我的 CKEditor 中。无论我做什么,我都不会出现 - 也许这与新的 拖放有关 添加按钮的方法取代了旧的基于文本的按钮。

  2. CKEditor (3.6.2) 与 CKEditor 模块 (7.x-1.6) GeSHi Filter (7x-1.0) 模块和 GeSHi 库遵循本指南peterpetrik.com/blog/ckeditor-and-geshi-filter< /em>.

    问题:与上面相同,我似乎无法让代码按钮出现在我的 CKEditor 中。

  3. 带有 CKEditor 和 Google Code Prettifier 模块+库的所见即所得模块。

    问题:虽然这个解决方案很简单并且无需编辑器即可完美运行,但我根本找不到让 CKEditor(或任何其他 RTE)停止

     内的 HTML 转义代码

我感谢您的帮助(这是我的第一篇文章:-)!

Does anyone have a confirmed/tested working way of setting up a rich WYSIWYG (like CKEditor or TinyMCE) with support for syntax highlighting (for pasting and sharing java/php/etc.) in Drupal 7.10?

I have now tried a variety of combinations, and I have struggled to get any of them to work in Drupal 7.10. Here is what I have tried:

  1. CKEditor (3.6.2) using CKEditor module (7.x-1.6) with Syntax Highlighter library and
    Syntax Highlighter Module (7x-1.1). I followed betuts.com/guide-install-syntax-highlighter-ckeditorckeditor-syntax-highlighter-plugin-drupal-7.

    Problem: I could not get a code button into my CKEditor. I just would not appear no matter what I did - perhaps it has something to do with the new drag-and-drop
    method
    of adding buttons that has replaced the old text-based one.

  2. CKEditor (3.6.2)with CKEditor module (7.x-1.6) GeSHi Filter (7x-1.0) module and GeSHi libarary following this guide peterpetrik.com/blog/ckeditor-and-geshi-filter.

    Problem: Same as above, I cannot seem to get the code button to appear in my CKEditor.

  3. WYSIWYG module with CKEditor and Google Code Prettifier module + library.

    Problem: Although this solution is simple and works beautifully with no editor, I simply cannot find a good way of getting CKEditor (or any of the other RTEs) to stop HTML-escaping code inside <pre> tags.

I appreciate your help (this is my first post :-)!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心不设防 2025-01-03 09:21:45

经过更多工作后,我得到了以下组合。我还在此处编写了更详细的指南。

  1. 将所见即所得模块与 CKEditor 库一起使用。我可以将我的代码插入预标记中(使用格式化样式),这对于您可以与 WYSIWYG 模块一起使用的大多数其他 RTE 来说也应该是可能的。
  2. 对于标记本身,我使用 Google Code Pretify 库安装了 Prettify 模块。这将在语法上突出显示 pre 或 code 标记中的任何代码。但如果您还启用了美化过滤器,您将在标签内得到不需要的 html 转义。这让我认为是 CKEditor 进行了上述场景 3 中所述的转义。

因此,这已被验证可与 Drupal 7.10、WYSIWYG 7-2.1 和 Prettify 7-1.x-dev 一起使用。

After some more work I got the following combination to work. I also did a more elaborated guide here.

  1. Using WYSIWYG module with CKEditor library. I can insert my code into pre tags (using the Formatted style), and this should also be possible with most other RTEs you can use with the WYSIWYG module.
  2. For the markup itself I installed the Prettify module with the Google Code Prettify library. This will syntax highlight any code within pre or code tags. BUT if you also enable the prettify filter, you will get unwanted html-escapes inside your tags. This is what caused me to think it was CKEditor who did the escapes as described in scenario 3 above.

So this is verified to work with Drupal 7.10, WYSIWYG 7-2.1, and Prettify 7-1.x-dev.

凤舞天涯 2025-01-03 09:21:45

Lars,

我们在发布到 我们自己的网站并且必须修改CKEditor插件。

修改后的插件代码发布在 https://github.com/dbrain/ckeditor-syntaxhighlight /tree/ckeditor-4

Lars,

We ran into similar issue on our site when posting to our own site and had to modify CKEditor plugin.

Modified plugin code is posted on https://github.com/dbrain/ckeditor-syntaxhighlight/tree/ckeditor-4

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文