Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 677959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:05:47+00:00 2026-05-14T01:05:47+00:00

My doc strings have references to other python classes that I’ve defined. Every time

  • 0

My doc strings have references to other python classes that I’ve defined. Every time Sphinx encounters one of these classes, I want it to insert a link to the documentation for that other class. Is this possible in Sphinx?

Specifically, I have a doc string like:

'''This class contains a bunch of Foo objects'''

I could write:

'''This class contains a bunch of :class:`~foo.Foo` objects'''

but I would prefer that Sphinx finds all text matching Foo and makes it seem as though I had typed
:class:~foo.Foo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:05:48+00:00Added an answer on May 14, 2026 at 1:05 am

    You can use macros.

    In my project, I have a header file that contains all “important” classes and global functions and their abbreviation. Two example lines:

    .. |PostItem| replace:: :class:`PostItem <hklib.PostItem>`
    .. |PostNotFoundError| replace:: :class:`PostNotFoundError <hklib.PostNotFoundError>`
    

    In my rst files, I include this header file. Then I can use the macros in any rst file:

    .. include:: defs.hrst
    
    |PostItem| is a nice class. |PostNotFoundError|, on the other hand is not.
    

    (You can include docstrings from Python source files as well, using the autogen extension. Macros in those will be replaced as well.)

    About your example: I would add Foo to the header file and write the docstring this way:

    '''This class contains a bunch of |Foo| objects'''
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a doc to rtf converter that will run from the command line,
I'm trying to read a .doc file into a database so that I can
Note: I found this Creating a Word Doc in C#.NET , but that is
How to create new PCL file similar to existing MS doc. I have MS
I have defined: [RdfSerializable] public class SomeItem { // Unique identificator of the resource
I have 2 strings, A and B. A contains HelloHowAreYou. B contains Bingo. I
Here is the code currently used. public String getStringFromDoc(org.w3c.dom.Document doc) { try { DOMSource
Is there a standard convention (like phpdoc or python's docstring) for commenting C# code
Should I be writing Doc Comments for all of my java methods?
How do I load MS Word document (.doc and .docx) to memory (variable) without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.