Skip to content

Instantly share code, notes, and snippets.

@postcasio
Created April 15, 2015 16:00
Show Gist options
  • Save postcasio/c668860620352f857fe5 to your computer and use it in GitHub Desktop.
Save postcasio/c668860620352f857fe5 to your computer and use it in GitHub Desktop.
atomdoc = require 'atomdoc'
marked = require 'marked'
doc = "
Public: Add one or more command listeners associated with a selector.
## Arguments: Registering One Command
* `target` A {String} containing a CSS selector or a DOM element. If you
pass a selector, the command will be globally associated with all matching
elements. The `,` combinator is not currently supported. If you pass a
DOM element, the command will be associated with just that element.
* `commandName` A {String} containing the name of a command you want to
handle such as `user:insert-date`.
* `callback` A {Function} to call when the given command is invoked on an
element matching the selector. It will be called with `this` referencing
the matching DOM node.
* `event` A standard DOM event instance. Call `stopPropagation` or
`stopImmediatePropagation` to terminate bubbling early.
## Arguments: Registering Multiple Commands
* `target` A {String} containing a CSS selector or a DOM element. If you
pass a selector, the commands will be globally associated with all
matching elements. The `,` combinator is not currently supported.
If you pass a DOM element, the command will be associated with just that
element.
* `commands` An {Object} mapping command names like `user:insert-date` to
listener {Function}s.
Returns a {Disposable} on which `.dispose()` can be called to remove the
added command handler(s).
"
lexer = new marked.Lexer
console.log lexer.lex(doc)
@postcasio
Copy link
Author

Output:

[ { type: 'paragraph',
    text: 'Public: Add one or more command listeners associated with a selector. ## Arguments: Registering One Command * `target` A {String} containing a CSS selector or a DOM element. If you pass a selector, the command will be globally associated with all matching elements. The `,` combinator is not currently supported. If you pass a DOM element, the command will be associated with just that element. * `commandName` A {String} containing the name of a command you want to handle such as `user:insert-date`. * `callback` A {Function} to call when the given command is invoked on an element matching the selector. It will be called with `this` referencing the matching DOM node. * `event` A standard DOM event instance. Call `stopPropagation` or `stopImmediatePropagation` to terminate bubbling early. ## Arguments: Registering Multiple Commands * `target` A {String} containing a CSS selector or a DOM element. If you pass a selector, the commands will be globally associated with all matching elements. The `,` combinator is not currently supported. If you pass a DOM element, the command will be associated with just that element. * `commands` An {Object} mapping command names like `user:insert-date` to listener {Function}s. Returns a {Disposable} on which `.dispose()` can be called to remove the added command handler(s).' },
  links: {} ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment