# Using editor fulllpost quote button on a post which uses HTML formatting mangles it

**URL:** https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249
**Category:** Bug
**Created:** [May 3, 2015, 3:12am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249 "2015-05-03T03:12:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![irrationalJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/irrationalj/32/115504_2.png) [@irrationalJ](https://meta.discourse.org/u/irrationalJ)
#### Post date: [May 3, 2015, 3:12am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/1 "2015-05-03T03:12:52Z")

</div>

OK, I **think** this is a bug. However, if it turns out that it actually is _not_ a bug, then I look forward learning _why_ it isn't.

While the option of using HTML to format your entire post is possible with DIscourse, there seems to be a problem quoting from a post which used HTML as **the** markup language.

What appears to happen is that all of the `\<` & `\>` characters around the HTML tags are converted to the `\<` and `\>` symbols. So, `

` in the original HTML becomes `\<p\>` when the post is quoted. The result is that the quoted text is unformatted and IMO unreadable.

I'll provide an example of this in a reply to this post below …

**Note:**  
How could this ever be a problem worth fixing? Who would be so insane as to create not just one, but thousands of Discourse posts using only HTML? It happened to the [tudiabetes.org](http://www.tudiabetes.org/) site. When the site was migrated from Ning to Discourse the Ning posts were copied/migrated to the Discourse site "as is" (I am guessing). This _"bug"_ makes it infeasible to quote anything for reference from the migrated HTML posts.

---

<div class="post-metadata">

### Author: ![irrationalJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/irrationalj/32/115504_2.png) [@irrationalJ](https://meta.discourse.org/u/irrationalJ)
#### Post date: [May 3, 2015, 3:16am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/2 "2015-05-03T03:16:06Z")

</div>

As promised here is a quote of the original post which I had hoped would illustrate what I said happens.

OK, so I was slightly wrong. The `&lt;` and `&gt;` symbols are used in the raw text. The result is that formatted version of the quoted text contains all of the HTML tags in the OP. Ooops.

But I’ll be damned if I’m going back and editing & correcting the OP. You get the point, yes?

> [@irrationalJ](#):
>
> \<p\>OK, I \<strong\>think\</strong\> this is a bug. However, if it turns out that it actually is \<em\>not\</em\> a bug, then I look forward learning \<em\>why\</em\> it isn’t.\</p\>\<p\>While the option of using HTML to format your entire post is possible with DIscourse, there seems to be a problem quoting from a post which used HTML as \<strong\>the\</strong\> markup language.\</p\>\<p\>What appears to happen is that all of the `&lt;` & `&gt;` characters around the HTML tags are converted to the `&lt;` and `&gt;` symbols. So, `&lt;p&gt;` in the original HTML becomes `&lt;p&gt;` when the post is quoted. The result is that the quoted text is unformatted and IMO unreadable.\</p\>\<p\>I’ll provide an example of this in a reply to this post below …\</p\>\<p\>\<strong\>Note:\</strong\>\<br /\>How could this ever be a problem worth fixing? Who would be so insane as to create not just one, but thousands of Discourse posts using only HTML? It happened to the \<a href=“[http://www.tudiabetes.org/](http://www.tudiabetes.org/)” target=“\_blank”\>tudiabetes.org\</a\> site. When the site was migrated from Ning to Discourse the Ning posts were copied/migrated to the Discourse site “as is” (I am guessing). This \<em\>“bug”\</em\> makes it infeasible to quote anything for reference from the migrated HTML posts.\</p\>

* * *

OK, after I had posted the above, one of my cats dope slapped me and pointed out there is an _“obvious”_ copy’n paste workaround. Copy the quoted text shown in the preview section and use it to replace the body of the quote in the editor window. I did this below to illustrate it.

`<sigh/>` Still, I hope that it will turn out to be reasonable (enough) to eventually correct the way Discourse handles this. Trying to explain even this _“simple”_ workaround to those in the _“Discourse is just too damn complicated & hard for normal people to use!”_ chorus is not a place one wants to visit. 😧 (Then again, maybe if no one tells the chorus about this then they just might never notice it. 😏 )

> [@irrationalJ](#):
>
> OK, I **think** this is a bug. However, if it turns out that it actually is _not_ a bug, then I look forward learning _why_ it isn't.
> 
> While the option of using HTML to format your entire post is possible with DIscourse, there seems to be a problem quoting from a post which used HTML as **the** markup language.
> 
> What appears to happen is that all of the \< & \> characters around the HTML tags are converted to the \< and \> symbols. So, \<p\> in the original HTML becomes \<p\> when the post is quoted. The result is that the quoted text is unformatted and IMO unreadable.
> 
> I'll provide an example of this in a reply to this post below …
> 
> **Note:**  
> How could this ever be a problem worth fixing? Who would be so insane as to create not just one, but thousands of Discourse posts using only HTML? It happened to the [tudiabetes.org](http://www.tudiabetes.org/) site. When the site was migrated from Ning to Discourse the Ning posts were copied/migrated to the Discourse site "as is" (I am guessing). This _"bug"_ makes it infeasible to quote anything for reference from the migrated HTML posts.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 3, 2015, 9:39pm UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/3 "2015-05-03T21:39:40Z")

</div>

I think the simplest fix here is to have the “quote whole post” just take raw, it will have some edge cases but will be a lot better than the alternative.

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [May 3, 2015, 10:33pm UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/4 "2015-05-03T22:33:08Z")

</div>

I think it’d be best to remove the quote content from the post and cook it separately, keeping track of the current nesting level. That’d also solve [quoted polls becoming new, distinct polls](https://meta.discourse.org/t/a-better-poll-feature/28008/41)…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 4, 2015, 5:45am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/5 "2015-05-04T05:45:58Z")

</div>

This is rather specific to quote whole post, and I would argue users should be discouraged from using that button in general… it is better to select just the text you want to reply to, and use the quote text button that appears over the selected text.

It is also somewhat specific to import cases where we imported as HTML, for future conversations it is _extremely_ unlikely people will type their new posts in raw HTML.

Not opposed to some kind of workaround, but context is everything here.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 5, 2015, 12:30am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/6 "2015-05-05T00:30:00Z")

</div>

I fixed this:

> [@irrationalJ](#):
>
> OK, I **think** this is a bug. However, if it turns out that it actually is _not_ a bug, then I look forward learning _why_ it isn't.
> 
> While the option of using HTML to format your entire post is possible with DIscourse, there seems to be a problem quoting from a post which used HTML as **the** markup language.
> 
> What appears to happen is that all of the `\<` & `\>` characters around the HTML tags are converted to the `\<` and `\>` symbols. So, `
> 
> ` in the original HTML becomes `\<p\>` when the post is quoted. The result is that the quoted text is unformatted and IMO unreadable.
> 
> I'll provide an example of this in a reply to this post below …
> 
> **Note:**  
> How could this ever be a problem worth fixing? Who would be so insane as to create not just one, but thousands of Discourse posts using only HTML? It happened to the [tudiabetes.org](http://www.tudiabetes.org/) site. When the site was migrated from Ning to Discourse the Ning posts were copied/migrated to the Discourse site "as is" (I am guessing). This _"bug"_ makes it infeasible to quote anything for reference from the migrated HTML posts.

[https://github.com/discourse/discourse/commit/66423e62dceabbb9f688569e02e5a91e3bb0201c](https://github.com/discourse/discourse/commit/66423e62dceabbb9f688569e02e5a91e3bb0201c)

It **will** raise other edge cases, but lets live with it and see who complains

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 5, 2015, 12:30am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/7 "2015-05-05T00:30:05Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 5, 2015, 12:31am UTC](https://meta.discourse.org/t/using-editor-fulllpost-quote-button-on-a-post-which-uses-html-formatting-mangles-it/28249/8 "2015-05-05T00:31:13Z")

</div>

> [@sam](#):
>
> see who complains

Oh I am pretty sure I know who will 😈
