How can I sync documentation with Github Pages?

后端 未结 10 1334
鱼传尺愫
鱼传尺愫 2020-12-12 10:14

I have a project together with several people and we have a README.md file with a bunch of GitHub Flavored Markdown that is rendered on our GitHub page. We also

10条回答
  •  旧巷少年郎
    2020-12-12 10:39

    Another method that I've gotten to work pretty successfully is using Ajax to fetch the docs using the Github API and a Javascript markdown engine to render the HTML (as also suggested by Nathan).

    1. Use the Github API and JSONP to fetch the doc from Github
    2. Decode the base64 content in the response from the Github API
    3. Render the markdown using a javascript markdown engine
    4. Display the rendered html

    Nathan expressed some concern over performance but in my experience, it loads seemingly instantly so I don't think it's actually a problem.

    The advantage is that it's easy to setup and it will always update your docs even if you just edit the markdown directly in a browser on github.

    I set up an example on Github pages at http://bradrhodes.github.io/GithubDocSync/ to show it working.

提交回复
热议问题