refined-github / refined-github

:octocat: Browser extension that simplifies the GitHub interface and adds useful features
MIT License
24.79k stars 1.49k forks source link

Easy copy code blocks from Markdown #1095

Closed lex111 closed 5 years ago

lex111 commented 6 years ago

For example, insert some icon inside the code block, when you click on it, all the content will be copied to the clipboard.

fregante commented 6 years ago

I assume you're talking about code blocks in comments. I saw an extension like that a while ago but it wasn't particularly pretty.

Here's a code block for fun

for i in 1..101 {
    if i % 15 == 0 {
        println!("FizzBuzz");
    } else if i % 5 == 0 {
        println!("Buzz");
    } else if i % 3 == 0 {
        println!("Fizz");
    } else {
        println!("{}", i);
    }
}

Where should the button be?

lex111 commented 6 years ago

image

Mottie commented 6 years ago

If you're interested, I've got a userscript that'll allow you to copy markdown code snippets.

lex111 commented 6 years ago

@Mottie thank you! This is what I had in mind!

@bfred-it Let's implement this in the extension!

sindresorhus commented 5 years ago

PR welcome.


For anyone that wants this, please also send this feature request to GitHub: support@github.com

dguo commented 5 years ago

If it helps, CodeCopy is an open source extension that does this for many sites, including GitHub.

fregante commented 5 years ago

I'm not particularly fond of buttons like these (noise + they might get in the way) and since there are already options, maybe we don't need to include this in Refined GitHub

fregante commented 5 years ago

I think that there are existing options for this and we don't need to implement it in Refined GitHub.

karlmutch commented 5 years ago

I don't think the above statement is true. It requires the reader to install a plugin/extension for their browser. The script tag is also not permitted for very good reasons for very similar motivations.

I think this is a reasonable request please reconsider.

busches commented 5 years ago

@karlmutch having the feature in RGH also requires an extension. RGH's goal is not to implement every feature possible, especially when existing options cover the feature.

peters95 commented 3 years ago

+1 for this idea it would be better if this was supported out of the box vs client-side configuration.

banagale commented 3 years ago

+! Github has already implemented some form of this internally in the Settings -> Actions -> Add self-hosted runner page:

Screen Shot 2020-12-05 at 9 25 28 AM

It would be very helpful if github wiki (and issues) got this as a markdown extension behavior. I can only imagine the amount of human time and productivity improvement this simple feature would add. Possibly one of the lowest hanging fruits for Github in improving the world of software.

fregante commented 3 years ago

requires the reader to install a plugin/extension for their browser.

I hope that people landing on this issue understand that :

this repo is NOT owned by GitHub.

This repo is for an extension. If you want this behavior natively, send this suggestion to GitHub, not here.

Or just use the codecopy extension. It works and it's supported.

fregante commented 3 years ago

This is now supported natively by GitHub https://twitter.com/natfriedman/status/1391862005095485440?s=21