# 投稿をWordpressブログ風にフォーマットする

**URL:** https://meta.discourse.org/t/formatting-posts-to-look-more-like-wordpress-blog/301133
**Category:** Support
**Tags:** wordpress
**Created:** [2024 年 3 月 27 日午前 11:03 UTC](https://meta.discourse.org/t/formatting-posts-to-look-more-like-wordpress-blog/301133 "2024-03-27T11:03:31Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![jimkleiber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jimkleiber/32/121814_2.png) [@jimkleiber](https://meta.discourse.org/u/jimkleiber)
#### Post date: [2024 年 3 月 28 日午前 1:53 UTC](https://meta.discourse.org/t/formatting-posts-to-look-more-like-wordpress-blog/301133/6 "2024-03-28T01:53:56Z")

</div>

WordPressの投稿にHTMLクラスが含まれており、それがDiscourseの投稿に正常に貼り付けられている（Discourseから投稿された生のHTMLで示されているように）にもかかわらず、Discourseが表示する際にHTMLクラスが削除されてしまう、というのが問題のようです。

> [@What are the different ways to customize content inside a post (custom attributes and such)](https://meta.discourse.org/t/what-are-the-different-ways-to-customize-content-inside-a-post-custom-attributes-and-such/226747/5):
>
> It is possible to uses some HTML classes in Discourse, however, most HTML in a post is sanitized for security reasons, and only very strict whitelisted HTML is allowed in markdown. To add classes to the white-list you must use a plugin, the sanitization happens server side as well as client side. Check out [Whitelisting HTML tags / attributes](https://meta.discourse.org/t/whitelisting-html-tags-attributes/159653) for some details on where to add the whitelisted attributes, and I believe it would look similar to something like this: [Discourse HTML Whitelist](https://github.com/pnewell/discourse-html-whitelist). and a…

そして、これを実現するためのプラグイン作成に関する追加情報はこちらです。

> [@Whitelisting HTML tags / attributes](https://meta.discourse.org/t/whitelisting-html-tags-attributes/159653):
>
> I vaguely remember that there was a way - using a site setting or a plugin - to add entries to the whitelist of allowed HTML tags and attributes ([https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/addon/white-lister.js](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/addon/white-lister.js)). I’m not very familiar with the internals of this part of Discourse. Does anyone have some pointers on how to add to this list using a plugin or maybe even site settings?

どちらの解決策が最も簡単かはわかりません。個人的には、HTMLクラスをホワイトリスト登録するのがもっと簡単であれば、HTMLクラスをホワイトリスト登録したいたびにカスタムプラグインを作成する必要がなくなるのですが。

投稿が表示される際にクラスが削除されないようにする方法を見つけることができれば、その後、WordPressサイトのHTML要素に対してDiscourseが適切なCSSを持っていることを確認する必要があります。

---

_[View the full topic](https://meta.discourse.org/t/formatting-posts-to-look-more-like-wordpress-blog/301133)._
