cuelang.org: presenting long code listing with a visual "ellipsis" #3121
Labels
cuelang.org
FeatureRequest
New feature or request
frontend
cuelang.org frontend UI/UX related
NeedsInvestigation
What page were you looking at?
https://cuelang.org/
What version of the site were you looking at?
cue-lang/cuelang.org@24ebac4
We need some way of allowing long code listings to be uploaded. These might come about for multiple reasons, but having a long code listing on the page isn't particularly practical because of the screen real estate taken up.
In such situations, we probably want to present the code listing "collapsed" with, say, the first 10 lines visible, some indication that there is more "hidden" code, the usual "copy" button on the right hand side, plus an "expand" button that allows it to the code listing to be fully expanded.
Relatedly, we need the ability to present a snippet of code before/after such a listing that is a "focus" on part of the code. Typically with long code listings, the following happens:
So this issue is really about adding support for two components:
We can leverage the
preprocessor
to do most of the lifting here to ensure that we have the focus on the right lines of code. e.g. thepreprocessor
could allow for a block which references an earlier upload block, a file within that upload, and lines within that file. That would gives us the lines we want to see. The frontend component would then be responsible for rendering those lines.Here is a possible way of rendering the "ellipsis" using a fade to white:
The text was updated successfully, but these errors were encountered: