Hello,

I'm trying to create a custom Sphinx directive that can be 
cross-referenced. For instance, I'd like to make an "exercise" directive 
that gives an example problem for the reader to solve, and which can be 
cross-referenced later ("see exercise 1.3").

The ordinary label syntax (.. _label:) doesn't work on custom directives. I 
could make a new domain and create an "exercise" object, but objects in 
domains don't appear to be customizable. For instance, I couldn't make my 
exercise directive display as an admonition or give it any custom features 
-- it would display like any other Python method or object. The 
add_object_type method lets me customize the node type of the role which 
allows cross-referencing of the object, but does not let me customize the 
node type of the object itself.

Arbitrary cross-referenceable directives would be incredibly useful; one 
could, for instance, create a mathematics textbook entirely in Sphinx, with 
theorems and exercises referenced and indexed.

Is there a way to do this?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sphinx-users?hl=en.


Reply via email to