GitHub Pages: How do I edit this page in markdown

2019-03-09 17:04发布

问题:

I'm not too comfortable with touching the generated HTML that the site gives, I was wondering whether there is any way to change the contents of my page in markdown formatting, the same way that I did upon creating the page?

Any input as to go about doing this would be awesome.

回答1:

By default, GitHub Pages helps you generate html pages only.

But if you setup your site to use jekyll, then you can store files in markdown. For example, in the _posts section of this repo 'cboettig/labnotebook' which is generated to carlboettiger.info.

See Help page "Using Jekyll with Pages"

More specifically (as highlighted in esfandia's answer), see "The Automatic Page Generator", which allows for markdown editing.

As commented by dregad, there is a new theme chooser in Dec. 2016:

See this article by Antriksh Yadav:


Update August 2016: Simpler GitHub Pages publishing now allows to keep your page files in a subfolder of the same branch (no more gh-pages needed):

So you don't need multiple branch anymore.



回答2:

If you replace index.html with index.md containing your original markdown text, and add a "Front Matter" section at the top, then you can do your page editing in markdown.



回答3:

It's totally possible and supported: just go back to "Settings", scroll down to GitHub Pages. The Source you used to create your initial page should still be there, and when you click on "Launch automatic page generator" it will allow you to update the markdown code right there in the browser.

When you're done you'll need to select the layout again, but once you're done with that it will create a new index.html, commit it using the GitHub pages source you chose, and publish the modified page.



回答4:

You need Jekyll. The documentation you are looking for is here: https://help.github.com/articles/using-jekyll-with-pages