TinyMCE 写出糟糕的 HTML!

发布于 2024-08-03 08:25:22 字数 526 浏览 3 评论 0原文

我目前已将 TinyMCE 合并到一个简单的博客/页面编辑应用程序的后端编辑器中,但我对其创建的 HTML 代码非常不满意。它会做各种混乱的事情,例如:

  • 将内联样式信息添加到跨度标记中,如果不直接编辑 HTML,您将无法摆脱这些信息。
  • 以无意义的方式嵌套标签(例如

    一些文本

    只是为了使某些内容变得粗体。)
  • 在不属于的地方添加空

     

    行,我尝试创建空行。

编辑:我查看了其他编辑器的列表(包括 SO 上的),但我想知道人们是否有更好的运气从他们的所见即所得编辑器中获得干净的代码。

对于在幕后输出更好的代码有什么建议吗?

I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app, but I'm extremely unhappy with the HTML code it creates. It does all sorts of messy things like:

  • Adding inline style information to span tags that you can't ever find to get rid of without editing the HTML directly.
  • Nesting tags in nonsense ways (e.g. <p><strong><p><span>some text</span></p><strong></p> just to make something bold.)
  • Adding empty <p> </p> lines where they don't belong and I'm not trying to create blank lines.

EDIT: I've looked at lists of the other editors out there (including on SO), but I want to know if people firsthand have had better luck getting clean code out of their wysiwyg editors.

Any recommendations for one that outputs better code behind the scenes?

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

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

发布评论

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

评论(3

魂ガ小子 2024-08-10 08:25:22

一个相当激烈的替代方案如何,使用 WYMIWYG(所见即所得)编辑器而不是另一个所见即所得编辑器。这样,作者就可以完全控制原理图标记以及他/她输入的内容。

不幸的是,我还没有找到像tinyMCE一样功能丰富且可用的工具,但它似乎已经取得了很大的进步 - 请参阅http://www.wymeditor.org/demo/

How about a rather drastic alternative, and using a WYMIWYG (What You Mean is What You Get) editor rather that another WYSIWYG editor. That way the author is in full control of the schematic markup as well as the content he/she is entering.

Unfortunately I haven't found one that is as feature rich and usable as tinyMCE, but it seems to have come a long way - see http://www.wymeditor.org/demo/

千纸鹤 2024-08-10 08:25:22

在将内容保存到数据库之前使用 HTML 净化器。

HTML 净化器

Use HTML purifier before saving the content into the database.

HTML Purifier

晨与橙与城 2024-08-10 08:25:22

我发现 JoomlaFCK 是 Tiny MCE 的一个非常好的替代品。
希望你喜欢它。
顺便说

一句,再见,我知道这是一个旧线程,但有人可能会使用它。 ;)

I found JoomlaFCK to be a very good alternative to Tiny MCE.
Hope you like it.
bye

BTW I know it is an old thread but someone might use it. ;)

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