前言介紹
- 這款 WordPress 外掛「Preserved HTML Editor Markup」是 2011-10-27 上架。
- 目前有 800 個安裝啟用數。
- 上一次更新是 2017-11-28,距離現在已有 2714 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.2.1 以上版本才可以安裝。
- 有 42 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
html | editor | markup | wpautop | white space |
內容簡介
這個外掛會保留使用者在 TinyMCE 編輯器中產生的 HTML 標記。不同於其他外掛,這個外掛允許開發人員在 HTML 標籤中工作,以及最終使用者在 WYSIWYG 可視化標籤中同時工作!當您在這些標籤之間切換時,您的 HTML 標記不再完全變成無法識別的形式。當您交付這個項目並停用 Visual 標籤時,您也不必讓使用者/編輯者面臨困境。
重要提示:請仔細閱讀安裝說明。如果您擁有現有內容,啟用此外掛後它將無法正確渲染,直到您使用Fix It工具修復它。
(有一位使用者沒有閱讀或跟隨這些步驟,然後恐慌地認為我毀了他們的網站。)
此外,它還支援 HTML5 塊錨標籤和其他 HTML5 元素,這是目前 WordPress 中不存在的任何現有的外掛所支援的。
版本1.5可能是我最後一個版本,因為我的女兒即將出生。我已經添加了對 HTML 標籤中的完整 JavaScript 代碼塊的支援。當切換到 Visual 模式時,它們是相容並會被保留下來。這使得支援幾乎完整的 HTML 保留,並利用WYSIWYG編輯器變得更加圓滿。您不需要像這裡建議的那樣將註釋代碼包裝起來:https://codex.wordpress.org/Using_Javascript,但如果您希望,仍然可以將其保留。
版本1.4只是一個較小的修補版本。使用者 @ denl 注意到插件 CataBlog 存在問題,因為它通過禁用其自定義文章類型的“show_ui”標誌來實現自己的管理功能。我忽略了任何沒有 GUI 的自定義文章類型,但這是一個不必要的過濾器,可能會限制其他外掛。這個更正允許任何支援 TinyMCE 編輯器的文章類型都可以使用在“管理”>“設定”>“寫入”下的工具進行“修復”。
自版本1.3以來,您現在可以在 HTML 編輯器中使用內置 CSS 和 JavaScript,並且所有內容都應該得到保留。清楚地說,這僅適用於標籤,例如 onclick 事件和樣式定義,而不是腳本塊本身。要啟用此功能,您必須通過將以下代碼添加到您的主題的 functions.php 中來禁用 wptexturize 和 convert_chars 濾鏡:
remove_filter("the_content", "wptexturize");
remove_filter("the_content", "convert_chars");
此新功能目前相當實驗性。我嘗試使其與 wptexturize 兼容,但發現沒有重複一些核心代碼在我的外掛中是不可能的。當啟用“停止刪除p和br標籤”設置時,它也不兼容 TinyMCE 高級插件。
我已在多個代碼範例上進行了測試,我對結果感到滿意,但如果您發現任何未被保留的內容,只需開啟支援票,我就可以解決它。
自版本1.2以來,您現在對內容如何創建有更多的控制權。大部分使用此外掛的先前注意事項現在都已解決。
您現在可以選擇使用斷行標籤 OR 段落標籤作為換行符。更好的是,您可以使用兩種方式,其中一個回車鍵插入BR標籤,而兩個回車鍵則將其包裹在段落標籤中。這非常適合在特定斷點處包裹標題,同時享受段落的語義優勢。
除了選擇要使用的標籤類型外,您還可以根據不同類型的文章,包括自定義文章類型,更改其行為。因此,頁面可以默認使用換行標籤,而博客文章可以默認使用段落標籤。
原文外掛簡介
This plugin preserves the user-generated HTML markup in the TinyMCE editor. Unlike other plugins this one allows developers to work in the HTML tab AND end-users to work in the WYSIWYG Visual tab at the same time! No longer will your HTML markup be completely munged into an unrecognizable form when you switch between those tabs. And you don’t have to hang your users/editors out to dry when you hand off the project with a disabled Visual tab.
IMPORTANT: Please read the installation instructions carefully. If you have existing content it will not render properly after activating this plugin until you use the Fix It Tools.
(One user didn’t read or follow these steps and panicked thinking I ruined their website.)
It also supports HTML5 Block Anchor tags in addition to other HTML5 elements, something that is currently not supported in WordPress via any existing plugins.
Version 1.5 will probably be the last version I release for a while since my daughter will be born soon. I’ve added support for full JavaScript code blocks in the HTML tab. They are compatible and preserved when switching to Visual mode. This rounds out the support for almost complete html preservation, with full use of the WYSIWYG editor. And you don’t need to wrap comment codes around it per the recommendations located here: https://codex.wordpress.org/Using_Javascript but you can leave them in if you want.
Version 1.4 was just a minor patch release. User @denl noticed a problem with the plugin CataBlog which implements its own administrative management features by disabling the ‘show_ui’ flag for its custom post type. I was ignoring any custom post type that didn’t have a GUI, but it was an unecessary filter that probably limited other plugins. This fix allows any post type that supports the TinyMCE editor to be “fixed” using the tools under Admin > Settings > Writing.
Since version 1.3 you can now use inline CSS and JavaScript in the HTML editor and everything should be preserved. To be clear, this applies to tags only, like onclick events and style definitions – not script blocks themselves. To enable this feature you must disable the wptexturize and convert_chars filters by adding the following code to your theme’s functions.php:
remove_filter("the_content", "wptexturize");
remove_filter("the_content", "convert_chars");
This new feature is pretty experimental at the moment. I tried to make it compatible with wptexturize but that proved close to impossible without duplicating a lot of core code in my plugin. It’s also not compatible with TinyMCE Advanced when the “stop removing p and br tags” setting is enabled.
I’ve tested it on a variety of code samples and I’m pleased with the results but if you find any content that isn’t preserved just open a support ticket and I should be able to fix it.
Since version 1.2, you now have a little more control over how content is created. And most of the previous caveats to using this plugin are now resolved.
You can now choose whether to use BR tags OR P tags for newlines. Even better you can use both, where one return key press injects a BR tag, and two return key presses will wrap a Paragraph tag. This is great for being able to wrap headers at specific break points all while enjoying the semantic perks of paragraphs.
In addition to choosing what type of tags to use, you can also change the behavior depending on the type of post, including custom post types. So Pages can default to BR tags, and Blog Posts can default to Paragraph tags.
If you have existing content that was created before activating this plugin, you can now use the Fixit feature to convert your existing content in a way that makes it render the same as before. Only use this feature (located under Admin > Settings > Writing: Fixing Existing Content) if you are installing this plugin for the first time, otherwise it will remove all of the formatted white space in your posts.
Multi-line HTML comments are now supported (Thanks to @cwlee_klagroup for suggesting the working fix!)
The Format drop down in the TinyMCE editor had a bug which is now fixed. It will now select “Format” if you place the cursor on a section of bare text. Currently the editor just leaves the previously selected format option in place. It’s minor but it’s good to know when you have bare text in your content.
There was a fairly problematic bug in the old version where in some browsers you couldn’t change the formatting of a single line in the Visual editor if you started from scratch. Choosing a different Format option would change the entire document, with the only work around being to edit the document in HTML mode. That was bad, and somehow went unnoticed for far too long. Anyway, that is fixed now.
The caveats that still remains are:
With script blocks added to your HTML markup, the right arrow key does not pass over them in the Visual Tab. You can down arrow over them however so this will likely never be addressed.
If you use the Paragraph tag setting for newlines there is a minor bug where it will only wrap your content in Paragraph tags if you specify Paragraph in the Format drop down or if you enter more than one paragraph of text. So if you just type one sentence and click save it will not wrap the content in Paragraph tags. I tried to fix this but ran out of my allotted time working on other core issues. Should be fixed in the next release.
For performance reasons, it will only preserve spaces if 4 spaces are used consecutively – i.e. an expanded tab in developer terms. It will not preserve intra-tag white space like
.
If you do add 4 or more spaces inside of an element tag it will corrupt the markup and mangle the output. But as this is intended for developer edits, this should be an extreme rarity given the habit is virtually non-existent in development communities.
PRE tags are not affected and behave as you would expect, however due to how browsers parse tags, the first newline in the content of a PRE tag will be wiped out unless it is padded with either another new line or multiple spaces.
CODE tags are not preserving white space at all, and when wrapped with PRE tags white space is still removed. I’m working to resolve this problem.
Arbitrary section
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Preserved HTML Editor Markup」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Black Studio TinyMCE Widget 》此外掛添加了一個新的 Visual Editor 小工具類型,讓您能夠在側邊欄中輕鬆地插入豐富的文字和媒體對象。使用 Black Studio TinyMCE Widget 時,您將能夠使用W...。
Shortcoder — Create Shortcodes for Anything 》Shortcoder 外掛可讓您建立 HTML、JavaScript、CSS 和其他代碼片段的自訂捷徑。現在,這些捷徑可以在文章/頁面中使用,並且該片段將取代其位置。, ✍ 輕鬆建立...。
Simple Sitemap – Create a Responsive HTML Sitemap 》簡單網站地圖 (Simple Sitemap) 是 WordPress 上最受歡迎的 HTML 網站地圖,現在使用更加簡單。你可以在文章編輯器中直接建立和預覽網站地圖! 不再需要使用難...。
Mammoth .docx converter 》Mammoth 設計用於將 .docx 文件(如 Microsoft Word、Google Docs 和 LibreOffice 創建的文件)轉換為 HTML。Mammoth 旨在利用文檔中的語義信息生成簡單和清...。
Code Embed 》注意: WordPress 5.0 及以上版本的使用者請查看常見問題以了解如何在區塊編輯器中使用此外掛。, Code Embed 外掛允許您在文章中嵌入程式碼(JavaScript 和 H...。
Raw HTML 》is capability is only granted to administrators. If you’re not an admin, you will need to ask them to add it to your role., Raw HTML is not r...。
PHP Everywhere 》注意:此外掛更新至 3.0.0 版本是一項重大變更,將移除 [php_everywhere] 短代碼和小工具。請透過外掛設定頁面中的升級嚮導,將原本的代碼轉換為 Gutenberg ...。
WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript 》這個外掛可以在需要時結合、縮小和緩存內聯的 JavaScript 和 CSS 文件,以加快頁面加載速度,並使用Minify PHP Framework。, 啟用此外掛後,您會發現您的 HTM...。
Minify HTML 》你可以在這個免費的測試網站試用這個外掛 => https://demo.tastewp.com/minify-html-markup, 有時候你可能會注意到自己網站的 HTML 標籤看起來較為混亂和...。
Allow HTML in Category Descriptions 》當您在類別描述文本區添加文字並保存類別時,WordPress會運行內容過濾器,剝除除最基本格式標籤以外的所有內容。, 這個外掛程式可以禁用具有必要權限的角色的...。
Advance Custom HTML 》這是一款用來專業編寫 HTML 代碼的高級 HTML 編輯器,提供不同的樣式、縮排與更多功能。, Advance Custom HTML 是一款功能強大、彈性十足的區塊外掛,讓您可...。
Kwayy HTML Sitemap 》Kwayy HTML Sitemap可以為您的網站地圖頁面生成HTML(而非XML)網站地圖。這個外掛不僅會顯示頁面和文章,還會顯示其他自定義的文章類型,例如產品等。您還可...。
Export WP Page to Static HTML/CSS 》Export WP Page to Static HTML/CSS 外掛是一個靜態 HTML 網站或頁面產生器,它能幫助您將您的 WordPress 網站或頁面轉換成靜態 HTML 網站,讓您可以將其託管...。
Code Widget 》Code Widget 是一個簡單的小工具,允許您插入任意的文字/HTML,執行 PHP 程式碼或 Short Code。此小工具解析 PHP 程式碼為簡單文字等等。, 只有擁有未過濾的 ...。
Preserved HTML Editor Markup Plus 》這個外掛保留了使用者在 TinyMCE 編輯器中產生的 HTML 標記。不像其他外掛,這個外掛允許開發人員在 HTML 標籤中工作,同時讓終端使用者在所見即所得的視覺化...。