How to see an HTML page on Github as a normal rendered HTML page to see preview in browser, without downloading?

后端 未结 10 925
情歌与酒
情歌与酒 2020-11-30 15:55

On http://github.com developer keep the HTML, CSS, JavaScript and images files of the project. How can I see the HTML output in browser?

For example this: https://gi

相关标签:
10条回答
  • 2020-11-30 16:46

    This isn't a direct answer, but I think it is a pretty sweet alternative.

    http://www.s3auth.com/

    It allows you to host your pages behind basic auth. Great for things like api docs in your private github repo. just ad a s3 put as part of your api build.

    0 讨论(0)
  • 2020-11-30 16:47

    Also, if you use Tampermonkey, you can add a script that will add preview with http://htmlpreview.github.com/ button into actions menu beside 'raw', 'blame' and 'history' buttons.

    Script like this one: https://gist.github.com/vanyakosmos/83ba165b288af32cf85e2cac8f02ce6d

    0 讨论(0)
  • 2020-11-30 16:51

    You can preview HTML code by using following Chrome extension - Run Selected HTML, quite simple to use.

    If you want to select all the code in read mode of GitHub, it is also quite simple, firstly move the mouse cursor to the beginning bracket of <html> in the top, then hold down the Shift key, and next move the cursor the ending bracket of </html> in the bottom.

    Run Selected HTML - Chrome Web store

    https://chrome.google.com/webstore/detail/run-selected-html/eefflcdphpehljcadbmkdpopmbamfefl/

    Step 1: In read mode, select all the body of the html code.

    Step 2: Mouse right click "Run Seleted HTML", then you can see the rendered result in new tab.

    The running result:

    0 讨论(0)
  • 2020-11-30 16:52

    If you don't want to download an archive you can use GitHub Pages to render this.

    1. Fork the repository to your account.
    2. Clone it locally on your machine
    3. Create a gh-pages branch (if one already exists, remove it and create a new one based off master).
    4. Push the branch back to GitHub.
    5. View the pages at http://username.github.io/repo`

    In code:

    git clone git@github.com:username/repo.git
    cd repo
    git branch gh-pages
    # Might need to do this first: git branch -D gh-pages
    git push -u origin gh-pages # Push the new branch back to github
    Go to http://username.github.io/repo
    
    0 讨论(0)
提交回复
热议问题