how to embed github file to a github pages blog post - github

I am creating a blog using github pages and jekyll. I wonder if there is a way to embed code snippets from a github file (i.e., a file in a repo) in a blog post. I can find a solution on this page about embedding gists: https://gist.github.com/benbalter/5555251.
No direct solution for github files, though.

Jekyll has a pretty nifty syntax-highlighting system (provides _sass/sytax-highlighting.scss is present and correct), so it would be possible to just copy the code over into a blogpost, using `s to wrap the code.
As per actually embedding from a Github repo, there is a pretty nifty project here, if you want to check it out.

Related

How can I rename a Page/Topic on GitHub wiki without renaming the file?

I want to update Topic/page titles on my GitHub wiki (which is currently using Markdown syntax). When I do that using the GUI it renames the Markdown files, and breaks all of the links.
I know that I can rename the Topic files in the Git repository and push the changes, but that doesn't help the broken links.
Is there a way to avoid this, and make GitHub Wiki's behave more like other Wiki products? I could not find an better way on GitHub documentation.
Welcome to StackOverflow. As best I can determine you cannot rename a GitHub Wiki page without its markdown file also being updated to the new name. The two are tightly coupled.
This Web Applications (StackExchange) Question has some alternatives you may consider, i.e. instead of renaming the page, create a copy. Then edit the original page so that it directs visitors to the new page via a link. This way the original page link remains valid but directs visitors to the new page.

Github:documents about github pages

Is there any document about the whole process of building my blog with github pages?I have read the official introduction,but less help.
There are two different ways to create a GitHub page:
Create a repo called YOUR_USERNAME.github.io
Create a branch called gh-pages on a standard repo
Later, you must put some HTML files and commit. You will see the page running. You can also use Jekyll which has a template engine but it's a bit hard to start with it.

GitHub: Linking to an issue from a wiki page

On GitHub, is there a simple way to reference an issue (eg: #1234) from within a markdown file such that it is displayed as a hyperlink?
I don't want to write out the full form each time, as in:
[#1234](//github.com/user/project/issues/1234)
In commit messages, issue numbers are automatically hyperlinked. Can this happen in wiki documents too?
(This is not a duplicate of this question which is simply asking about markdown hyperlink syntax.)
It doesn't happen in wiki documents.
You can use a relative url but it isn't that much of a shortcut. It also depends on where you are in the project.
For example in the Readme.md in the master branch of the project:
[#1](../../issues/1)
On the github wikis:
[#1](../issues/1)
Anywhere:
[#1](/user/project/issues/1)
(h/t to VertigoRay for suggesting this)

How to generate a website from GitHub wiki pages

I've used GitHub pages to generate a beautiful website for my project (this one). Now I want to keep the documentation of my project up to date, and having everything in a single README.md file is probably not scalable to the many features we are adding.
So, I thought that the best place to keep the documentation is the GitHub wiki, but I'd like to integrate the wiki to the gh-pages generated site, keeping the beautiful layout.
How would I take the GitHub wiki and generate an HTML web site with a customizable layout?
Here is an example URL for a wiki:
https://github.com/golang/go/wiki
On the same page you will find a clone link:
https://github.com/golang/go.wiki.git
Then run the Markdown files through Hugo or even create a new repository
to the host site based on the Wiki.
You could include your wiki as subtree.
BTW, GitHub Pages now no longer need the gh-pages branch. Create a repository named your-user-name.github.io; it will automatic generate to a website. See GitHub Pages for more detail.

Viewing .rst within a "github pages" site

I'm moving an open source project's documentation over to Github Pages but I'm stuck on moving the .rst files.
We have a ReadMe.rst which you can see here in the code. I'd like to link to that page from our main documentation page but GitHub doesn't render the .rst as HTML so the browser simply downloads the text of the .rst file when you click the link).
There are of course tools to render .rst as HTML but that's a serious extra step. The whole reason we started using .rst was entirely because GitHub renders it automatically in code pages. You'd think there'd be some way to get this authomatic rendering happening for Github Pages...
GitHub Pages does not have support for .rst/RestructuredText. It only supports Markdown and Textile conversion to HTML.
GitHub Pages does not have support for reStructuredText directly, but Anne Gentle has created a nice demo of how you can get something working with reasonably simple steps:
https://github.com/annegentle/create-demo
Especially useful to look at the github workflow for how to automatically generate the needed HTML from reStructuredText sources on every commit.