skip to Main Content

Recently, I started experimenting with the GitHub API getting specific data from public repos. Long story short, I want to grab specific parts of the README.md file from a repo.

For example, the master branch from Facebook’s react repository I want to grab the text under the Documentation header the GitHub API. Is this possible? Any methods of achieving this are welcome. Thank you!

API : React README.md API Data

Public Github URL: React public repo

2

Answers


  1. There is no way to do this with the API, but one easy way is with sed; try this from a Linux command line:

    curl https://raw.githubusercontent.com/facebook/react/master/README.md | 
        sed -n '/## Documentation/,/##/p'
    

    This will return everything between the Documentation header and the next one.

    Login or Signup to reply.
  2. There is a very awesome way to use any GitHub repository MARKDOWN.md file with the use of API.

    https://raw.githubusercontent.com/{owner}/{repo}/{branch}/README.md
    

    the above API returns everything in your README.md file in raw MarkDown format.
    api-use-picture

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search