I find the answers to What is the difference between GitHub and gist? unsatisfying, and I'm wondering if the difference (partially) lies in their treatment of HTML. In particular, I'm wondering:
Is it possible to point others to an HTML file on github.com such that when they view the file, they view the HTML page rather than its source? Normally on github, and even when the extension in the URL bar is .html, the HTML code is not interpreted by the browser (why?).
When an HTML page is viewed on gist.github.com, the HTML page is indeed seen rather than its source. Is this the main (or a main) feature of the difference between github and gist?
Is it possible to point others to an HTML file on github.com such that when they view the file, they view the HTML page rather than its source?
Only by using Github Pages
Normally on github, and even when the extension in the URL bar is .html, the HTML code is not interpreted by the browser (why?).
Because the purpose of Github is to manage code, not to host webpages.
URLs do not have file extensions. Browsers determine what to do with content based on the Content-Type header.
When an HTML page is viewed on gist.github.com, the HTML page is indeed seen rather than its source. Is this the main (or a main) feature of the difference between github and gist?
It doesn't when I test it.
Github proper is for hosting Git repositories.
Gist is for showing ad-hoc code samples managed by git, but without the full interface to the repository.
Related
when I go to my website directory it shows all my files and not to my landing page, is there a way to fix this? I have tried everything even looked through the internet without any clear response. I am close to finishing my website I only need to resolve this problem.
Thank you!
The issue seems to be that you are not on the HTML file, but on the folder.
To fix this issue, you have to redirect yourself to the HTML landing page.
/ar/home.html
This should show your HTML landing page correctly rendered.
Tip: Normally, the main page is called index.html by convention. This can be helpful. For example, the Live Server extension on Visual Studio Code will automatically go to index.html if the file isn't specified. Other hosting services, like GitHub Pages, also do the same.
None of the extensions, IDEs and hosting services listed above are sponsored! They are just used for the sole purpose of examples.
In conclusion, you need to go to the HTML file, instead of the folder.
I have created a html file using R markdown, and when I open it in browser, it looks exactly how I want. But if I upload the same html file in github and open there, it gives me totally different outlook.
https://github.com/syedaash/ML-Project/blob/main/ML_project.html is the link of my html doc in github, which is not I want. But if I open the html file from my local computer in a browser it's good. Why is that and what to do?
GitHub does not automatically load and render an HTML file because GitHub is about code, therefore going straight to any file will display the internals of that file, not how it would be rendered on a browser.
The HTML Preview project has a way to render HTML files hosted on GitHub, you can just append your HTML path like so and put it on your README for example:
https://htmlpreview.github.io/?https://github.com/syedaash/ML-Project/blob/main/ML_project.html
However, I would recommend that you look into creating a GitHub Page for your project, you only need to make a few changes and turn it on and you got it.
Edit: So I checked on your status #Alex and it looks like you created the GitHub Page for your GitHub profile, which is not rendering your profile properly. Maybe this tutorial from codeacademy will be easier to understand that you can get GitHub Pages rendered for EVERY repo if you wish. You can see I do that with my own simple project with its live site.
If you want to see the output of the file (what it looks like when opened in a browser, you have to enable Github pages for your repository, more here. The link you sent is just the HTML text file that you have written, not what it actually would look like in a browser. Github pages hosts the HTML text file (link you sent) so that you can actually see it in a browser window.
GitHub is to share code not to deploy website. So now you should use GitHub Pages this is my sample website Hariienesh1901 hosted by GitHub Pages. See tutorial from GitHub https://guides.github.com/features/pages/
So there is a lot out there about creating anchors in markdown, and creating internal table-of-contents-type anchors in a notebook. What I need though is the ability to access an anchor in my notebook on Github from an external source, e.g.:
https://github.com/.../mynotebook.ipynb#thiscell
I've got a number of interactive tutorials hosted this way, and a single manual that I want to be able to link to sections of the notebooks for. I can add the anchor tags into markdown cells just fine, using:
<a id='thiscell'></a>
but when I try using the link as I wrote above, it just loads the notebook at the top, as if there was no reference to an anchor.
GitHub renders notebooks using a separate domain, render.githubusercontent.com, and integrates the output in a nested frame. This means that any anchors on the GitHub URL won't work, because the framed document is a different URL entirely.
Moreover, the framed content is not easily re-usable, as the result is a cached rendering of the notebook with a limited lifetime. You can't rely on it sticking around for later linking!
So if you need to be able to link to sections in a notebook, you'd be far better off using the Jupyter notebook viewer service, https://nbviewer.jupyter.org/. It supports showing notebooks from any public URL including GitHub-hosted repositories and GitHub gists. You can also just enter your GitHub user name (or username/repository) for quick access.
This notebook viewer is far more feature-rich than the one GitHub uses. GitHub kills all embedded JavaScript, and strips almost all HTML attributes. Any embedded animations are right out. But the Jupyter nbviewer service supports those directly out of the box.
E.g. compare these two notebooks on nbviewer:
https://nbviewer.jupyter.org/github/mjpieters/adventofcode/blob/master/2018/Day%2020.ipynb
https://nbviewer.jupyter.org/github/mjpieters/adventofcode/blob/master/2018/Day%2021.ipynb
with the same notebooks on GitHub:
https://github.com/mjpieters/adventofcode/blob/master/2018/Day%2020.ipynb
https://github.com/mjpieters/adventofcode/blob/master/2018/Day%2021.ipynb
The first one contains an animation at the end, the second has a complicated table made easier to read by use of some HTML styling and anchor links.
I had the same problem. As a workaround, I have delegated the rendering of my notebook to http://nbviewer.jupyter.org. It's just a matter of providing its GitHub public url and clicking Go!
Of course, the internal links still don't work under GitHub, but I have now a functioning notebook somewhere on the web, which is what I actually wanted in the first place.
I hope this applies to your case too.
I have written a small manual in HTML that I would like others to be able to use. Is there a way that I can 'package' the website folder structure into one file so that nobody has to worry about finding the index.html page?
MHTML, short for MIME HTML, is a web page archive format used to combine resources that are typically represented by external links (such as images, Flash animations, Java applets, and audio files) with HTML code into a single file.
More info here.
I managed to collect the behavior of a complex web site into a webarchive. Thereafter I would like to turn that webarchive into an html set of nested directory. Yet, when I did it both with Waf and with a commercial software bought on the the Apple store, what I get is just the nested directory with the html page at the bottom and no images, nor css nor working links.
If you are interested the webarchive document is at:
http://www.miafoto.it/it/GiroMilano.webarchive
while the weak product of the extraction is at:
http://www.miafoto.it/it/Giromilano/Pagine/default.aspx
and the empty directories above.
In addition to the different look, the webarchive displays the same behavior as the official web site - when a listbox vales is selected and then the button pushed - while the extracted version produces a page with no contents by loading itself rather than the official page.
As you may see the webarchive is over 1MB while the extraction just little over 1 KB.
What is wrong with it and how may I perform such an apparently trivial business with usable results?
Thanks,
textutil -convert html example.webarchive
Be careful — html with files is created in the same folder as webarchive!
Also, I had to open .html with text editor and replace "file:///image.tiff" links (replace "file:///" with "") so they point to relative path.
Also, not all browsers display .tiff images.
Who knew we have Stack Overflow wiki?
I find that this WebArchiveExtractor.app works on my Mac (Mojave OS) –
https://robrohan.github.io/WebArchiveExtractor/
I managed the issue by finding all parameters being submitted in the page and submitting them too in my script, ignoring the webarchive.
To save HTML pages on mac, I use chrome. Download and install it and save your page as HTML. Safari will save the web pages with webarchiveformat and for me, it's very hard to deal with it.