Highlight-based quoting ruby text messes up formatting

Continuing the discussion from Inline language markup? (language learning site):

Not sure if this would be considered a bug or a request for enhancement. Basically, when you quote ruby text, the quote doesn’t show up correctly. For example:

ほん

If you quote this you’ll get something like:
日に本ほん語

Could this be updated in some way so the quote includes the ruby tags for proper formatting? Or is that consider an “advanced” quote that will only work on full post quoting?

3 Likes

Yeah I would like us to implement this it should be straightforward … our JS implementation of HTML -> Markdown has a minor oversight.

@vinothkannans can you add to your list?

5 Likes

Awesome. To add one thing, I noticed that often furigana (rt tagged text) above the last character won’t get highlighted and therefore doesn’t get quoted (but it should). It probably won’t be a big deal to handle since that’s all within the last ruby tag anyway, but it’s something to keep in mind when implementing.

4 Likes

OK, just keep in mind, this is not a major priority for us but I think we should get it done over the next month or two. It is assigned out.

2 Likes

Any chance this will be worked on soon-ish? :slight_smile:

1 Like

Sure, I already bumped it up in my to-do list for this week.

4 Likes

It’s done. The below commit should resolve this issue.

https://github.com/discourse/discourse/commit/aa5d4e9f6ee179a554d186aaab30da367f95557a

4 Likes

It might be good to keep all the ruby-related tags that have been whitelisted, even though rb and rp aren’t used as much anymore. rp is used for legacy support for old browser though, so maybe not particularly relevant for Discourse. No big deal one way or the other, just thought I should mention.

EDIT:
More importantly, when I test this on the word in my OP (and only that word) it misses the surrounding ruby tags, so it doesn’t format the text as expected. When I highlight text on either side it before quoting, includes the ruby tag, but that workaround wouldn’t work if the word was the first or last part of the post. Is there anything that can be done to make sure it includes the ruby tags?

1 Like

Sure, I’ll whitelist those tags if needed. Also, it is easy to do in a PR contribution.

It is a problem with the browser level UX in copy-paste functionality. We can’t do much here.

3 Likes

I’ll get a Discourse dev environment set up one of these days. :sweat_smile:

Understood. Worst case scenario I can do a full post quote to get the proper HTML for those cases. This is still a huge improvement. Thanks!

3 Likes

The rb and rp tags are now whitelisted.

https://github.com/discourse/discourse/commit/7dbde18f025dfa03103dbc75a647d28ed8752e02

4 Likes

This topic was automatically closed after 25 hours. New replies are no longer allowed.