Permalink
Browse files

Merge pull request #3 from rafBM/patch-1

Prettify README.
  • Loading branch information...
2 parents 2a584e9 + 531bcc6 commit a16cecf2cf5aa3823a2b2d31c787fbe900b0e249 @madrobby madrobby committed Aug 28, 2011
Showing with 41 additions and 39 deletions.
  1. +41 −39 README.markdown
View
@@ -1,7 +1,9 @@
-keymaster.js is a simple (~60 LoC) micro-library for defining and
+# keymaster.js
+
+`keymaster.js` is a simple (~60 LoC) micro-library for defining and
dispatching keyboard shortcuts. It has no dependencies.
-It's a work in progress, so spare me your nerdrage and instead
+Its a work in progress, so spare me your nerdrage and instead
contribute! Patches are welcome, but they are not guaranteed to make
it in.
@@ -10,45 +12,45 @@ Two global methods are exposed, `key` for defining shortcuts, and
See `test.html` for a live demo.
-```
- key('c', 'issues', function(){
- console.log('c/issues');
- });
-
- key('command+r', 'issues', function(){
- console.log('Hijacked Command+R, damn!');
- return false;
- });
-
- key('i', function(){
- keyScope('issues');
- console.log('Switched to "issues" scope. Command+R is now no longer reloading...');
- });
-
- key('i', function(){
- console.log('(example of multiple assignment)');
- });
-
- key('o, enter, left', function(){
- console.log('o, enter or left pressed!');
- });
-
- key('ctrl+c', function(){
- console.log('this is not the command line');
- });
-
- key('⌘+right,shift+left,ctrl+shift+alt+d', function(event){
- console.log('command+right, or shift+left, or ctrl+shift+alt+d');
- console.log('here is the event: ', event);
- return false; // prevent default && stop propagation
- });
+```javascript
+key('c', 'issues', function(){
+ console.log('c/issues');
+});
+
+key('command+r', 'issues', function(){
+ console.log('Hijacked Command+R, damn!');
+ return false;
+});
+
+key('i', function(){
+ keyScope('issues');
+ console.log('Switched to "issues" scope. Command+R is now no longer reloading...');
+});
+
+key('i', function(){
+ console.log('(example of multiple assignment)');
+});
+
+key('o, enter, left', function(){
+ console.log('o, enter or left pressed!');
+});
+
+key('ctrl+c', function(){
+ console.log('this is not the command line');
+});
+
+key('⌘+right,shift+left,ctrl+shift+alt+d', function(event){
+ console.log('command+right, or shift+left, or ctrl+shift+alt+d');
+ console.log('here is the event: ', event);
+ return false; // prevent default && stop propagation
+});
```
-TODOs:
+## TODO
- * Make behavior with INPUT/SELECT/TEXTAREA configurable
- * Comprehensive test suite
- * Make it work on IE (7+) (low priority)
+* Make behavior with `INPUT` / `SELECT` / `TEXTAREA` configurable
+* Comprehensive test suite
+* Make it work on IE (7+) (low priority)
-keymaster.js is (c) 2011 Thomas Fuchs and may be freely distributed under the MIT license.
+`keymaster.js` is (c) 2011 Thomas Fuchs and may be freely distributed under the MIT license.
See the `MIT-LICENSE` file.

0 comments on commit a16cecf

Please sign in to comment.