Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only directive blocks headers from being in TOC #3539

Closed
roxannemoslehi opened this issue Mar 10, 2017 · 1 comment
Closed

Only directive blocks headers from being in TOC #3539

roxannemoslehi opened this issue Mar 10, 2017 · 1 comment

Comments

@roxannemoslehi
Copy link

Subject: Only directive blocks headers from being in TOC

Problem

  • If you use the "only directive" to flag off some content, any headers inside that directive won't show up in the TOC.

Procedure to reproduce the problem

**CONTENTS:**

.. contents::
   :local:
   :depth: 1

Title1
======

Some content. 

.. only:: internal

   Title2
   ======

   Some more content.

Title3
======

Even more content.

Error logs / results

When you run:

sphinx-build -b html -t internal ....

The generated TOC at the top of the page looks like this:

CONTENTS:

  • Title1
  • Title3

Expected results

What we really want is this:

CONTENTS:

  • Title1
  • Title2
  • Title3

The "Title2" header should only be missing from the TOC if I run something like sphinx-build -b html -t external so using a -t flag other than internal.

@tk0miya
Copy link
Member

tk0miya commented Mar 11, 2017

Sorry, "only" directive was not designed to control section. This behavior is specification.
(refs: #2132)

@tk0miya tk0miya closed this as completed Mar 11, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants