The quote feature strips out some useful HTML tags from the content

Using the quote or copy quote button strips out some HTML tags that should be kept.

Reproduction steps:

  1. Quote or copy quote this sentence:

    There are 1080 atoms in the observable universe and the glucose molecule formula is 6H12O6. this however won’t be stripped out.

  2. The copied content in the composer will appear as:

    There are 1080 atoms in the observable universe and the glucose molecule formula is 6H12O6. this however won’t be stripped out.

The removed HTML tags are <sup> and <sub>. I suppose there are others I’m not aware of, which should also be kept.

It looks more like an oversight than a bug.

6 Likes

Here’s the current list of allowed HTML tags when converting the selected content to markdown: https://github.com/discourse/discourse/blob/85773eee21a476e89fcab89213a5b827a7fa6d8e/app/assets/javascripts/discourse/app/lib/to-markdown.js#L147

  static allowedTags() {
    return [
      "ins",
      "del",
      "small",
      "big",
      "kbd",
      "ruby",
      "rt",
      "rb",
      "rp",
      "mark",
    ];
  }

It could be expanded a bit. I don’t think allowing <sup> and <sub> would cause issues, but what do I know, I’m not a programmer. :upside_down_face:

3 Likes