ray-project / ray

Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
33.5k stars 5.69k forks source link

[Ray Serve] Copy and paste code snippet also copies line numbers #40936

Open robertnishihara opened 11 months ago

robertnishihara commented 11 months ago

Description

On this page https://docs.ray.io/en/latest/serve/model_composition.html

When I click the "copy" button in the upper right corner of the code snippet, it copies all of the line numbers (which prevents the example from working).

Screenshot 2023-11-03 at 11 08 57 AM

This is what it looks like after pasting the code into an editor (the line numbers should not be pasted).

Screenshot 2023-11-03 at 11 10 07 AM

This is probably a problem in multiple places in our documentation, not just here.

Link

No response

angelinalg commented 11 months ago

This is a known problem. The workaround is to turn off line numbers, but in these cases the line numbers are needed to refer to specific lines of code in the docs. This is a docs infrastructure/tooling issue. @peytondmurray, do you have any ideas on how to fix this?

peytondmurray commented 11 months ago

I was never able to reproduce this issue on my local machines, and I expect it to depend on what browser and what version you're using. There are CSS styles which control the selectability of elements, but they're browser-dependent. Even forcibly overriding the styles of the <span> elements that contain the numbers didn't seem to work for @angelinalg. Being unable to replicate the problem I'm unsure exactly what the best way to proceed with this issue would be. See https://github.com/ray-project/ray/issues/39652 for more information.

peytondmurray commented 11 months ago

I can spend a little time digging into sphinx_copybutton to see if there's something there I can change. For now, I'd propose closing this issue as a duplicate of #39652.

angelinalg commented 11 months ago

This issue is slightly different from #39652, which is doing a copy and paste. @MattEWeber is able to reproduce this one, which uses the "copy" button, but not #39652. I suggest we keep both open as they seem to be different mechanisms.