GithubHelp home page GithubHelp logo

Comments (2)

mgeier avatar mgeier commented on July 26, 2024

Thanks for the report and for the MWE which makes this easily reproducible!

Only the combination of the three then causes this bug / WARNING.

Are you sure you need all three to cause the problem?
When I remove 'nbsphinx' from the extensions, I still get the warning.

It looks like there is already an issue at sphinx-argparse which doesn't involve nbsphinx: sphinx-doc/sphinx-argparse#14

nbsphinx and autosectionlabel both try to create/embed ids for headings

nbsphinx indeed creates section IDs (because Jupyter uses a different scheme than Sphinx):

class CreateNotebookSectionAnchors(docutils.transforms.Transform):
"""Create section anchors for Jupyter notebooks.
Note: Sphinx lower-cases the HTML section IDs, Jupyter doesn't.
This transform creates anchors in the Jupyter style.
"""
default_priority = 200 # Before CreateSectionLabels (250)
def apply(self):
all_ids = set()
for section in self.document.traverse(docutils.nodes.section):
title = section[0].astext()
link_id = title.replace(' ', '-').replace('"', '%22')
if link_id in all_ids:
# Avoid duplicated anchors on the same page
continue
all_ids.add(link_id)
section['ids'] = [link_id]
if not all_ids:
logger.warning(
'Each notebook should have at least one section title',
location=self.document[0],
type='nbsphinx', subtype='notebooktitle')

However, this is only done for *.ipynb source files, and not for "normal" *.rst files:

CreateNotebookSectionAnchors,

So if I'm not mistaken, this isn't even active in your MWE.

It might lead to problems if a Jupyter notebook is involved, though?

from nbsphinx.

dkuegler avatar dkuegler commented on July 26, 2024

I have done some further investigation and I know believe this is not an nbsphinx issue, but argparse. It was a bit hard to trace this issue, as it was thrown in auto section label and I subsequently searched for where labels where also created.

from nbsphinx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.