Comments (8)
That makes sense, I hadn't realized that there's value in copying all the commands alone. How about this: Only for console
code blocks, we display two buttons. One is the regular "copy entire block" button, but the other copies just the commands.
I'll prototype it tomorrow/over the weekend, and put up a PR + demo :)
from primer-spec.
I did consider suggesting it only for one-liner, but found that to be too limiting. If you have a multi-line console block, copy-and-pasting all the multiple lines of commands to the console actually does run them serially, so it could work as intended.
If one assumes a console prompt in front of each command, maybe copy only the commands so recognized, skipping potential console outputs or comments?
from primer-spec.
It would be interesting to see what icons you come up with to distinguish the two cases.
Assuming you have control over mouse functions on the browser, an alternative could be that drag-to-select on console
select only the commands, leaving out the prompts, outputs, and comments. The clipboard-copy button can be left as is, to copy everything, and you don't need to add another button.
from primer-spec.
The 'copy all commands' button video demo looks good! Thanks!
from primer-spec.
This is a nice idea! One question in my mind: This makes sense for code blocks with a single line, but how do we deal with multi-line console blocks (which might also contain console output)?
Alternatively, maybe the global βcopyβ button should exclude the prompts when the console block has only one line. What do you think?
from primer-spec.
It would be interesting to see what icons you come up with to distinguish the two cases.
I just realized I don't have a good icon for this yet
Another alternative: Is there ever a use-case for copying an entire console
block along with its outputs? What if we changed the "copy" button only for console
blocks into a "Copy all commands" button?
An alternative could be that drag-to-select on
console
select only the commands, leaving out the prompts, outputs, and comments.
^ This is a nice idea too!
from primer-spec.
An alternative could be that drag-to-select on console select only the commands, leaving out the prompts, outputs, and comments.
^ This is a nice idea too!
Actually, this isn't possible in any browser except Firefox βΒ only Firefox support selecting multiple disjoint text ranges. From (MDN)
There are ways to work around the browser limitations, but would likely involve a lot more work (which I think may be overkill for Primer Spec
from primer-spec.
This feature will be released with v.1.7.0 later this month. Closing this issue for now, let me know if you have questions :)
from primer-spec.
Related Issues (20)
- `script/server` requires specific shells HOT 7
- Bump header level styles in sidebar if needed HOT 1
- Primer Spec v2: Require deploy via GitHub Actions? HOT 1
- Task Lists: Use 'pointer' cursor on hover
- Multi color highlighting HOT 5
- Spooky icons even when Spooky theme not chosen HOT 2
- Data-highlight inside callout HOT 2
- Sidebar links broken in preview HOT 5
- Dark mode code blocks flash when settings is closed HOT 1
- Markdown tables are not rendered HOT 2
- Copy button in enhanced codeblock omits whitespace HOT 3
- Enhanced code block copy-paste trailing newline
- [PR Previews] PDFs do not generate with correct styles the first time.
- [Code blocks] Overflow gets clipped in print previews
- [Enhanced code blocks] No-line-numbers variant doesn't occupy full width
- [Enhanced code blocks] Code block in EECS 280 P1 doesn't highlight lines HOT 1
- [Enhanced Code Blocks] Line-by-line copying excludes empty lines
- Local render Liquid Exception HOT 6
- Copying an enhanced codeblock duplicates newlines HOT 1
- Sidebar has wrong URLs in PR previews HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from primer-spec.