admin管理员组文章数量:1122832
This is a paragraph and a hr-separator in html:
<p>Test</p>
<hr/>
This is what happens when I create it in the visual editor:
<!-- wp:paragraph -->
<p>Test</p>
<!-- /wp:paragraph -->
<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->
Yeah, my paragraph started and endend, thanks for clarifying my p-tags. What use have those comments? Can I somehow disable the creation of them? Lets give the paragraph some styling:
<p class="has-text-align-center has-secondary-color">Test</p>
This is what the visual editor does:
<!-- wp:paragraph {"align":"center","style":{"elements":{"link":{"color":
{"text":"var:preset|color|secondary"}}}},"textColor":"secondary"} -->
<p class="has-text-align-center has-secondary-color has-text-color
has-link-color">Test</p>
<!-- /wp:paragraph -->
If I remove this crap, it looks completely the same. So what is the point? Can someone from a technical perspective explain why wordpress is bloating my html with json-data-commentaries instead of just having a clean html/css style binding? Why is the editor storing data in commentaries instead of parsing them from the html it just wrote in the first place, where all this data is already stored in classes?
This sounds like a rant and partly it is, but I really try to understand the technical reasoning behind it.
This is a paragraph and a hr-separator in html:
<p>Test</p>
<hr/>
This is what happens when I create it in the visual editor:
<!-- wp:paragraph -->
<p>Test</p>
<!-- /wp:paragraph -->
<!-- wp:separator -->
<hr class="wp-block-separator has-alpha-channel-opacity"/>
<!-- /wp:separator -->
Yeah, my paragraph started and endend, thanks for clarifying my p-tags. What use have those comments? Can I somehow disable the creation of them? Lets give the paragraph some styling:
<p class="has-text-align-center has-secondary-color">Test</p>
This is what the visual editor does:
<!-- wp:paragraph {"align":"center","style":{"elements":{"link":{"color":
{"text":"var:preset|color|secondary"}}}},"textColor":"secondary"} -->
<p class="has-text-align-center has-secondary-color has-text-color
has-link-color">Test</p>
<!-- /wp:paragraph -->
If I remove this crap, it looks completely the same. So what is the point? Can someone from a technical perspective explain why wordpress is bloating my html with json-data-commentaries instead of just having a clean html/css style binding? Why is the editor storing data in commentaries instead of parsing them from the html it just wrote in the first place, where all this data is already stored in classes?
This sounds like a rant and partly it is, but I really try to understand the technical reasoning behind it.
Share Improve this question asked Aug 3, 2024 at 17:01 rhavinrhavin 1216 bronze badges 2- 2 If you want to get rid of then, don't use WordPress. Try another CRM. Those tags that you want to get rid of, are the core of the block system of WordPress as I have already pointed on your other question. – Iogui Commented Aug 3, 2024 at 18:20
- 2 I don't think they're useless comments, I think what you're referring to is how the block editor works. – Tony Djukic Commented Aug 5, 2024 at 2:06
2 Answers
Reset to default 2The block editor is a hideous abortion but it's here to stay. Your only recourse if you don't like the way it operates is to use a plugin that replaces it altogether. Attempting to manually edit the mess it generates will break things. Attempting to manually write HTML outside of an HTML block will break things.
- Switch to code view and manually delete the comments
- Use a plugin or extension that removes HTML comments.
- Check the editor's settings for an option to disable these comments.
本文标签: cssWhy does the quotvisual editorquot add useless htmlcomments and how can I get rid of them
版权声明:本文标题:css - Why does the "visual editor" add useless html-comments and how can I get rid of them? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736298790a1930302.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论