Keeping GH homepage in sync with README.md

守給你的承諾、 提交于 2019-12-07 19:49:39

问题


While creating GitHub Pages for my project I was suggested to import existing README.md as the project's homepage. Later, I merged gh-pages with master and ended up with both index.html and README.md.

The "problem" is that the updates to README.md won't affect index.html. Is there any simple way to keep them in sync? Preferably with zero Jekyll knowledge...


回答1:


Here's what I came up with, in case someone is interested.

Typically I write HTML using Jade preprocessor, and luckily it does support GitHub Flavored Markdown which is the language README.md is written in. So my steps where as following:

  1. Translate index.html generated by GH Pages to Jade. I used online html2jade tool;
  2. Save the output to index.jade;
  3. Locate section block in the resulting markup in index.jade and replace its entire content with:

    section include:md README.md

  4. Run jade index.jade which produces new, automatically generated index.html;
  5. Commit both files to gh-pages.

See example in this commit on GitHub.



来源:https://stackoverflow.com/questions/22449520/keeping-gh-homepage-in-sync-with-readme-md

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!