Reputation: 137
I am currently writing a small documentation on Github Wiki. I have a repo for my example codes and would like to cite some lines from examples codes in my wiki.
Rather than writing a code block statically, I simply want to "get 1st to 5th lines of code from this file", so when ever I update the an example code, the codes in the wiki will be updated.
Is it possible?
github.com/username/repo/main.cpp :
#include "test.h"
int main(){
}
In wiki: (Get the first line of ../main.cpp)
#include "test.h"
Upvotes: 2
Views: 924
Reputation: 3099
You can reference your code using permalink feature in GitHub. For example reference looks like this:
https://github.com/git/git/blob/master/README#L18-L20
Here is the full answer:
How to link to specific line number on github
Upvotes: 4
Reputation: 106500
This isn't really possible, since the Wiki is statically generated content. There's no option to my mind to add dynamic content in this fashion.
This does force the developer to keep well on top of their documentation, however.
Upvotes: 2