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 9153923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:21:04+00:00 2026-06-17T12:21:04+00:00

How can I list functions, classes, etc… to show up in the table of

  • 0

How can I list functions, classes, etc… to show up in the table of contents in Sphinx?

Or, more generally, how can I add arbitrary entries within a page (not subtitles) to the table of contents?

BTW: I’m not documenting Python code, so I can’t use the autodoc tools.

Edit

I tried the directive .. contents:: name, but that seems to be for placing a ToC, not defining an entry.

Edit: Partial Solution

I copied the basic/localtoc.html template to my _templates directory.

{{ pagename }} gives the path to the current file and {% include filename %} lets me include a file, so I could presumably combine those, and just generate my own Table of Contents for every file whenever conf.py is run. I will try this, but is there a more automatic solution?

  • 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-06-17T12:21:05+00:00Added an answer on June 17, 2026 at 12:21 pm

    Instead of creating lots of individual templates, one can create a single template that uses javascript to populate extra entries on the table of contents at load time.

    I can use viblo’s script from Toc/list with all classes generated by automodule in sphinx docs that dynamically generates lists of Classes, Functions, and Variables.

    My _templates/localtoc.html then becomes:

    <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
    {%- if display_toc %}
    
      {{ toc }}
    {%- endif %}
    <div class="custom-index container">
    <script type="text/javascript" src={{ pathto(master_doc)[:-10] + '_static/pymunk.js' }}></script>
    
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you create a list of functions and then execute them sequentially, perhaps passing
.append Function adds elements to the list. How can I add elements to the
I'm using functions instead of classes, and I find that I can't tell when
I have some POCO classes which can generally divided into two groups, for example:
Can I see in firebug profiler funcitons list in order those call? Do you
There's a function in PHP where you can get a list of the user
I'm wondering how can I write a function: 'a list*int -> 'a list*list that
How can i use opendir function to read the directory list of a remote
How can i get a lambda list specification of a some function parameters, or
How can I build a function slice(x, n) which would return a list of

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.