内容中的代码高亮显示以及所见即所得编辑器中的代码显示
我现在正在开发一个网站,我现在遇到的是在内容中显示代码的可能性 - HTML、JavaScript、CSS、PHP、ActionScript 或其他内容。我正在使用 CodeIgniter 开发网站。我找到了一个插件可以做到这一点,但不幸的是它不起作用,它也没有输出任何错误。那么,我要问的是 - 如何在我的网站内容中正常显示代码?而且,我当然会拥有一个管理面板来完成这一切,并且将使用所见即所得编辑器来添加文章。如何确保如果我复制 PHP 或其中的任何代码,它不会用 WYSIWIG 编辑器 HTML 标签包装它?预先感谢,如果您知道答案但不完全理解我的问题,请询问更多详细信息。
问候,埃德
I'm developing a website right now and what I've came across now is a possibility to display code in content - HTML, JavaScript, CSS, PHP, ActionScript or whatever. I'm developing the website using CodeIgniter. I have found a plugin to do it, but unfortunately it doesn't work, it also doesn't output any errors. So, what I'm asking for - how to display the code normally in content of my website? And also, I'm of course gonna have an admin panel for all that, and for adding articles a WYSIWYG editor will be used. How do I make sure that if I copy PHP or whatever code in there, it doesn't wrap it with WYSIWIG editors HTML tags? Thanks in advance, ask for more details if You could know the answer but don't understand my question completely.
Regards, Ed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 google-code-prettify 进行语法突出显示怎么样?它的开发活动非常高,并且只使用 JavaScript 和 CSS。所有代码都包装在
How about using google-code-prettify for syntax highlighting? It has a really high development activity and uses just JavaScript and CSS. All code is wrapped into
<pre>
tags. In order to print XML-like code, you need to escape some symbols like<
with its entity references. I never used CodeIgniter, but I guess it has the needed abilities.