Bake entities into your tweets; turning text plus entities into beautiful, customisable HTML.
Bake Twitter entities into your tweets; turning text plus entities into beautiful, customisable HTML. Useful when you're interacting with the Twitter API.
Current Version: 1.0.0
Node Support: 0.6, 0.8, 0.10
Browser Support: Android Browser 2.2–4.2, Firefox 3.6, Firefox 4–22, Google Chrome 14–28, Internet Explorer 6–10, Mobile Safari iOS 3–6, Safari 4–6
;//> The toilet of fail… with//> <a href="" title="Perry Harlock">@perryharlock</a>//> <a href="">pic.twitter.com/XN0xYhnSPR</a>
$ npm install tweet-baker$ bower install tweet-baker$ component install rowanmanning/tweet-baker
Alternatively, you can download
lib/tweet-baker.js and include it in your page with a script.
Tweet Baker can be required with CommonJS and AMD, or found on
window.bake if you're including with a script.
Tweet Baker provides sensible default templates, meaning that you can use it simply by calling bake with your tweet object as an argument.
var bake = ;var tweetHtml = ;
If you wish to customise the HTML which is output by Tweet Baker, you can do so by creating your own baker. Call
bake.make with an object containing your template functions. These are simple functions which recieve an entity construct and return HTML:
var bake = ;var myBake = bake;var customTweetHtml = ;
Note that each property in your template object matches the name of an entity type returned by the Twitter API. For an example of how to build custom templates, look for
Because Tweet Baker templates are just functions, you can use almost any template engine; just pass your compiled templates into
If you wish to contribute to Tweet Baker, fork this repository locally and install dependencies with
npm install. Now you can run the following commands to lint and test the code.
$ make lint # Run JSHint on the code$ make test # Run unit tests
Please ensure there are no lint errors or failing tests before opening a pull request.
Tweet Baker is licensed under the MIT license.