sphinx-contrib / coffeedomain /

Filename Size Date modified Message
1.8 KB
423 B

CoffeeScript Domain

Author: Stephen Sugden <glurgle@gmail.com>


This extension adds a CoffeeScript domain with autodoc support to Sphinx.

This relies on coffeedoc to extract source comments from .coffee files. To install coffeedoc globally:

npm install -g coffeedoc


First you must add the extension to your list of extensions in conf.py:

extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.coffeedomain']

Because Python has no clue about where your CoffeeScript sources are located, you must tell it where to look in your conf.py like so:

coffee_src_dir = os.path.abspath('../')

Depending on the module system you use, you might want to change the coffeedoc parser from its default commonjs to requirejs:

coffee_src_parser = 'requirejs'

Finally, if your project is primarily CoffeeScript, you might want to define the primary domain as well:

primary_domain = 'coffee'

Directives and Roles

This domain provides module, function, class and method directives, as well as meth, class, and func roles for cross-referencing. In order to reference another object, use it's fully-qualified name: The module name, a double colon, and the dot separate path to the object within the module.

For example, to reference the swizzle function in the file lib/widgets.coffee, write :coffee:func:`lib/widgets::swizzle. You can drop the leading :coffee if your primary domain has been set to coffee, and you can drop the module name iff you are linking from within the lib/widgets module.


You can document entire modules easily with automodule:

.. automodule:: mymodule
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.