Is anyone thinking about or working on a onebox for Pastebin? The Gist onebox is pretty good but it seems many more of our people (and here too, I think) are going with pastebin instead.
Sure, can you research that @techapj and see what’s involved to make that work with Oneboxer?
For the raw contents, all you need to do is take the Paste ID and make a request to
/raw.php?i=<paste id>. I’m not sure how to get the language, date, author, etc.
@techapj Did you happen to find an easy solution for this? I’ve tried to encourage GitHub gists but old habits die hard.
Okay, I just created a custom onebox engine for Pastebin!
Enjoy, and thanks for nudging me about this @downey
And the open source clone hastebin?
It seems like
hastebin.com does not provide any API access, nor any oEmbed endpoint.
Yes not an embed point but it has the same /raw/ function as pastebin.
You’d need to lobby them to support oEmbed or OpenGraph…
Wouldn’t it be better to remove the
max-height: 100px though? Only 3 lines are shown even if there are more…
Thats’s because if
max-height property is not provided then the one line pastes takes up 150px height by default. Adding
max-height: 100px limits that to 100px. See:
Shouldn’t that be min-height then?
Not exactly. Something is forcing iframes to be 150px tall. Need to figure out where that is happening to figure out how to properly fix it.
Okay, big thanks to @RyanReese (who found the spec for me and solidified that I was on the right track), but unfortunately this is part of the CSS2 spec.
Visual formatting model details (search for 150)
In short, Chrome or whatever browser you are using is enforcing the 150px iframe size (so long as they follow the CSS2 spec).
If you can, the idea would be to detect if it is greater than 100px, if it is, set the height style and max-height to 300px (to give it some room to show the user what data is there. Otherwise, set it to 100px for both attributes.
Also, it would be ideal to handle these max-height/min-height/height styles in a class labelled pastebin-onebox so it is easier to override versus attaching it to the iframe via inline styles.
Maybe have a pastebin-onebox (which is the 100px setting) and a pastebin-onebox-large for the 300px setting
You could have the oneboxing code download raw.php and use the ‘large’ if there’s more than 1 line.
Okay I fixed this issue by removing Pastebin iframe and instead extracting first 10 lines of a paste, similar to GitHub Gist onebox.
See the improved pastebin onebox demo here: