Open s-makin opened 4 months ago
This sounds like the fix should ideally go to Sphinx (or the copy-code extension?). I'm fine with tracking it here so one of us can look into it, but we should consider contributing it to wherever the problem originates from.
Issue: Google Chrome inserts a trailing whitespace at the end of a code block when you select the text by triple-clicking.
Why is this a problem? With the copy-code extension active, if you triple-click to highlight (as many developers might be accustomed to), Chrome inserts a trailing space in the command which then means you can't run it directly because you get a unicode character at the end of the command.
This doesn't happen on Firefox at all, and on Chrome it doesn't happen if you use the copy-code button as intended, or click+drag to highlight.
The cause: Sphinx seems to insert a bunch of tags around every word in the command, and then closes the code block with a that has spaces before it to create the line break, as follows. Note, I've included links to two pages from the server docs to illustrate the issue, since we have the same content on Discourse vs GitHub, both generated from standard Markdown:
Old
refers to the Discourse docs where this doesn't happen.New
refers to the documentation using the starter pack where this does happen.New-fixed
is the most basic suggested fix, if it's possible to remove those additional spaces between the block-ending tags.New-fixed-even-better
is the ideal solution, where we would find some way to strip out not just the spaces between the block ending tags, but also the additional tags (some of them are even empty, when you examine the html).Thanks in advance!