Imported topic via embedding will not render normally

(Quim Gil) #1

Hi, this post was posted through embedding:

It was edited further to improve its presentation, but for some reason it doesn’t render the video windows, the lists… What is more strange, while editing the topic the editor renders it correctly.

Here is a copy & paste of the same content in a new test post:


Judging from the revision histories, it seems the cooked version (HTML) does not match with the raw version (the original content in composer).

Could you try Rebuild HTML? It is in the post’s admin wrench: rebuild html button

I’d wait for someone from the team to save the day if that doesn’t work; I have little knowledge of how editing a topic (created for embedding purposes) works.

(Quim Gil) #3

Good point. I forgot to mention in my first post that I had tried to rebuild the HTML several times, to no avail.

(Quim Gil) #4

I wonder whether this is an #embedding bug (or feature). I have tried other posts coming from the source and none of them would apply the regular formatting when edited.

Of course it could be a problem specific to this source, but I don’t have a second website at hand to test.

(Gerhard Schlager) #5

Yeah, it’s more or less a problem with this specific source and the way you are using embedding.

Embedding uses the HTML of the source page and renders it unchanged within Discourse. It doesn’t interpret any Markdown. The cook_method used by Discourse for such posts is called raw_html. Unfortunately the composer’s preview knows only about the regular cook method. So, when you edit a post created by embedding, you won’t get what you see.

There are multiple options how you could resolve this:

  • Make sure the source page has good HTML and all the content you want to see in Discourse.
  • When you edit such a post, you can use everything HTML has to offer. Make good use of it and your posts will look great.
  • Create a regular topic and use Markdown for all the formatting and features like oneboxing. Configure your external site differently, so that it uses existing topics instead of creating new ones. See (Alternate Configuration) Linking to existing topics in Embedding Discourse Comments via Javascript for more information on this.

(Quim Gil) #6

Thank you @gerhard, it is very useful to know that this is actually a feature. It makes sense when you know the reasoning behind.

The idea is to embed posts from several external sites. I don’t have direct access to the administration of these sites, and even the possibilities of the owners of those sites might be limited. In any case, the JavaScript plus the possibility to configure a CSS selector does provide a flexible path for multiple situations.

For what is worth, having the possibility to define a RSS feeds per origin would simplify this problem too, since the RSS filter also acts as a selector of sorts. However, I am realizing that this use case might be too niche nowadays – see Embedding: one RSS feed for each host.