lsegal/rubydoc.info — Issue #36: Suggestion: Link back to Github for github-fetched generated docs
Author: jrochkind
Created: 2011-10-21 23:17:18+00:00
State: open

I suggested (https://rubydoc.tenderapp.com/discussions/suggestions/4-suggestion-links-back-to-github) that http://rubydoc.info ought to do this.

Then lsegal suggested it would be best to do this with Javascript. That seemed an odd way to do it, but I said, okay, give it a shot.

Then I wrote this javascript that seems to work pretty darn well if it's applied to any rubydoc.info page in the github area. I just wrote/tested it 'greasemonkey' style, I didn't try running rubydoc.info locally and putting it into source myself.

https://gist.github.com/1305162

Then I realized that in fact these days the majority of my rubygems.info use is for 'gem' area not 'github' area, and this wouldn't do anything for me there, even if the gem source was in github. Then I got depressed and lost interest in spending TOO much more time on this.

Then I noticed that the JS code I wrote conflicts with your JS code for hide/show source. Only because of where it inserts the "link to github" link into the DOM I think. Either it needs to be changed to insert into the DOM somewhere else, or the hide/show source JS needs to be changed to be more precise in it's selectors instead of blindly assuming whatever's next() in the DOM after it is the source.

Now I file a ticket here with my JS code, as lsegal suggested, in case anyone else wants to run with it. I think I'm done. It is pretty cool though! I might make a little JS bookmarklet for myself to use this code, if it doesn't make it into rubydoc.info deployed.