Refined-github: Add button to preview HTML files

Created on 17 Feb 2018  路  12Comments  路  Source: sindresorhus/refined-github

very useful for .html files

enhancement good first issue help wanted

Most helpful comment

https://raw.githack.com/ is the alternative that is not planning to shut down soon

All 12 comments

Can you please elaborate a bit more about what you're looking for?

When i'm browsing a github repo and I want to see the webpage of an html file, i will paste it into rawgit.com

e.g. I see this file https://github.com/CodingTrain/website/blob/master/CodingChallenges/CC_11_PerlinNoiseTerrain_p5.js/index.html
so i go to http://rawgit.com, paste the URL, and get this: https://rawgit.com/CodingTrain/website/master/CodingChallenges/CC_11_PerlinNoiseTerrain_p5.js/index.html

The difference is subtle:

RawGit serves raw files directly from GitHub with proper Content-Type headers.

I wouldn't add another Raw button that is _only sometimes_ different.

I probably wouldn't replace the current Raw button with one linked to rawgit (maybe? because it breaks expectations)

Not sure how discoverable it would be to add a _modifier_+click on the Raw button to open rawgit instead

Perhaps we can add a View/Preview button for HTML files, I think that's the only case where rawgit links are visibly different.

Something like this in Gists when the file is HTML:

image

I think this issue can be closed, as RawGit will soon shut down: https://rawgit.com/

RawGit is now in a sunset phase and will soon shut down. It's been a fun five years, but all things must end.

GitHub repositories that served content through RawGit within the last month will continue to be served until at least October of 2019. URLs for other repositories are no longer being served.

If you're currently using RawGit, please stop using it as soon as you can.

Are there any alternative services?

There's always this option if someone's up for it

No way! They鈥檙e closing it because of spam, no one here is gonna clone the service (and its issues) just to preview HTML files 馃槂

https://raw.githack.com/ is the alternative that is not planning to shut down soon

This seems really easy:

const rawButton = select('#raw-url');
if (rawButton && /\.html?/.test(rawButton.pathname)) {
    rawButton.after(
        <a href={rawButton.href.replace('https://github.com', 'https://cdn.staticaly.com/gh')}>Preview</a>
    );
}

features.add({
    ...
    include: [
        isSingleFile
    ],
    exclude: [
        isEnterprise
    ]
})

Anyone who wants it, just needs to create a feature called html-preview-link and add documentation for it. Follow contribute.md

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hkdobrev picture hkdobrev  路  3Comments

vanniktech picture vanniktech  路  3Comments

sompylasar picture sompylasar  路  3Comments

durka picture durka  路  3Comments

Arcanemagus picture Arcanemagus  路  3Comments