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

Invalid section numbering #4628

Closed
nowox opened this issue Feb 16, 2018 · 3 comments
Closed

Invalid section numbering #4628

nowox opened this issue Feb 16, 2018 · 3 comments

Comments

@nowox
Copy link

nowox commented Feb 16, 2018

Subject: The document title should not always be numbered

Problem

With a file such as

==========
Document Title
==========

.. sectnum:: 

Section
=====

Subsection
------------

I am expecting to see

Document Title

1. Section

1.1 Subsection

Unfortunately, the document title is also numbered which does not make any sense here.

1. Document Title

1.1 Section

1.1.1 Subsection

To show that I am not the only one to think that way, if you look at how GitHub render ReST files here:

https://github.com/nowox/sphinx-fix-sectnum/blob/master/index.rst

You will see that the numbering is the same as what I want

Procedure to reproduce the problem

git clone https://github.com/nowox/sphinx-fix-sectnum
cd sphinx-fix-sectnum
sed -i "s/'fix-secnum'//" conf.py
make html

To see the corrected version:

git reset --hard master
make html
@tk0miya
Copy link
Member

tk0miya commented Feb 17, 2018

In sphinx, --no-doc-title option of docutils is set (note: internal name is doctitle_xform). The reason of that is a conflict with toctree.

FYI: Without --no-doc-title, docutils promotes a top-level section title to document title. As a result, sectnum directive does not assign a number to it. But it means Sphinx does not treat it as section.

@tk0miya
Copy link
Member

tk0miya commented Feb 17, 2018

I don't know this is a specification or not. But it seems difficult to support it to me.

@tk0miya
Copy link
Member

tk0miya commented Mar 6, 2018

I'm closing this because this is intentional change of Sphinx.
Thanks,

@tk0miya tk0miya closed this as completed Mar 6, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 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