{"id":13612287,"url":"https://github.com/bwillis/jekyll-github-sample","last_synced_at":"2025-03-17T15:13:35.365Z","repository":{"id":17488594,"uuid":"20272699","full_name":"bwillis/jekyll-github-sample","owner":"bwillis","description":":bookmark_tabs: Get a sample of a Github public repo file","archived":false,"fork":false,"pushed_at":"2023-03-17T02:34:16.000Z","size":33,"stargazers_count":58,"open_issues_count":11,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-02T13:09:02.505Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwillis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-05-28T21:14:31.000Z","updated_at":"2025-02-22T16:28:06.000Z","dependencies_parsed_at":"2024-01-14T04:53:37.590Z","dependency_job_id":"af028dc1-3b85-420e-91cf-abf71d4f6d83","html_url":"https://github.com/bwillis/jekyll-github-sample","commit_stats":{"total_commits":26,"total_committers":8,"mean_commits":3.25,"dds":0.6923076923076923,"last_synced_commit":"57a1529af40ed4ed566d469537e2656d062939bd"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwillis%2Fjekyll-github-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwillis%2Fjekyll-github-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwillis%2Fjekyll-github-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwillis%2Fjekyll-github-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwillis","download_url":"https://codeload.github.com/bwillis/jekyll-github-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056424,"owners_count":20390719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T20:00:26.483Z","updated_at":"2025-03-17T15:13:35.339Z","avatar_url":"https://github.com/bwillis.png","language":"Ruby","funding_links":[],"categories":["Tags"],"sub_categories":[],"readme":"# jekyll-github-sample\n\nTwo Jekyll Liquid tags to display a code sample from a file in a public Github repo and provide a reference to it.\n\n## Install\n\n1. Add the gem to your `Gemfile`.\n    ```ruby\n    gem 'jekyll_github_sample'\n    ```\n1. Install.\n    ```sh\n    bundle install \n1. Add the gem to your Jekyll `_config.yml`.\n    ```yaml\n    plugins: \n      - jekyll_github_sample\n    ```\n1. Start Jekyll.\n\n## Live Examples\n\nA [write up](https://bwillis.github.io/2014/05/28/include-github-repo-code-in-jekyll/) on my Jekyll blog including samples referencing this repo's code, meta.\n\n## github_sample Usage\n\n```liquid\n{% github_sample URL_WITH_USERNAME_REPO_AND_FILE \u003cSTART_LINE_NUMBER\u003e \u003cEND_LINE_NUMBER\u003e %}\n```\n\n* URL_WITH_USERNAME_REPO_AND_FILE - the relative path to the Github repo file, prefer a file with the commitish in it so it won't change when recompiling occurs. A url to this README would be: `bwillis/jekyll-github-sample/blob/a3bc9e82412d364aa76e9308ab53ff2bddaa2faf/README.md`\n* START_LINE_NUMBER - (optional) number that is the first line to include (0 based)\n* END_LINE_NUMBER - (optional) number that is the last line to include, if excluded will read to end of file\n\nOne can also specify the lines to include based on markings in the file itself.\nThis is done by invoking\n\n```liquid\n{% github_sample URL_WITH_USERNAME_REPO_AND_FILE tag:TAG_NAME %}\n```\n\nAnd placing the strings `[START TAG_NAME]` and `[END TAG_NAME]` anywhere in the lines immediately before and after the content you wish to include.\n\n\n## github_sample_ref Usage\n\n```liquid \n{% github_sample_ref URL_WITH_USERNAME_REPO_AND_FILE %}\n```\n\n* URL_WITH_USERNAME_REPO_AND_FILE - the relative path to the Github repo file, prefer a file with the commitish in it so it won't change when recompiling occurs. A url to this README would be: `bwillis/jekyll-github-sample/blob/a3bc9e82412d364aa76e9308ab53ff2bddaa2faf/README.md`\n\n## Example Usage\n\nThis is how you would display, reference and highlight code in your Jekyll post.\n\n```liquid\n{% github_sample_ref /bwillis/versioncake/989237901cb873f96df12be48cbf1239be496bd7/Appraisals %}\n\n{% highlight ruby %}\n{% github_sample /bwillis/versioncake/989237901cb873f96df12be48cbf1239be496bd7/Appraisals 0 5 %}\n{% endhighlight %}\n```\n\n## Thanks!\n\nThanks to all those who have helped make this really awesome:\n\n* [heedfull](https://github.com/heedfull)\n* [robertwb](https://github.com/robertwb)\n\n## License\n\nJekyll Github Sample is released under the [MIT license](https://www.opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwillis%2Fjekyll-github-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwillis%2Fjekyll-github-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwillis%2Fjekyll-github-sample/lists"}