Skip to content

toctree directive not properly rendering #63

@adam-grant-hendry

Description

@adam-grant-hendry

Describe the bug

The {toctree} directive renders improperly as tables (cards?) in the previewer, yet sphinx properly builds the page.

NOTE: I blurred the project title.

To Reproduce

index.md # demo

The demo.

:hidden:
:maxdepth: 2
:caption: Introduction

_pages/introduction.md
:hidden:
:maxdepth: 2
:caption: Contributing

_pages/contributing.md
_pages/code_of_conduct.md
:hidden:
:maxdepth: 2
:caption: FAQ

_pages/faq.md
conf.py """Documentation configuration file.

This file is read by the sphinx documentation builder to generate our documentation.
"""

from future import annotations

import importlib.resources as rsrc
import os
import sys
from datetime import datetime, timezone

import demo

-- Project information ----------------------------------------------------------------

project = 'demo'
copyright = f'2024-{datetime.now(tz=timezone.utc).year}, Adam Hendry' # noqa: A001
author = 'Adam Hendry'
root_package = 'demo'
version = demo.version
release = version

-- Path setup -------------------------------------------------------------------------

with rsrc.path(root_package, 'init.py') as file_:
root = file_.parent.parent

packages = [
root / root_package,
root / r'docs',
root / r'tests',
]

for pkg in packages:
# In Python 3.6 and later it is recommended to use os.fspath() instead of str() if
# you need to do an explicit conversion. This is a little safer as it will raise an
# error if you accidentally try to convert an object that is not pathlike.
sys.path.insert(0, os.fspath(pkg.resolve()))

-- Extensions -------------------------------------------------------------------------

extensions: list[str] = [
'myst_parser',
'numpydoc',
'sphinx_book_theme',
'sphinx.ext.intersphinx',
'sphinx_copybutton',
]

myst_heading_anchors = 6

-- General configuration --------------------------------------------------------------

Paths are relative to source

html_static_path = ['_static']

master_doc = 'index'

List of files relative to source to ignore when looking for source files

exclude_patterns: list[str] = [
'_build',
'build',
]

-- HTML Output ------------------------------------------------------------------------

html_theme = 'sphinx_book_theme'
html_css_files = [
'css/custom.css',
]

String appended to project name with hyphen in <title> tag of individual pages and

used in the navigation bar as the “topmost” element. It defaults to '

v documentation'. Remove so only project name appears in title.

html_title = 'demo'
html_short_title = project

html_theme_options = {
'repository_url': 'https://github.com/adam-grant-hendry/demo',
'use_repository_button': True,
'home_page_in_toc': True,
}

Removes the "View Source" hyperlink

html_show_sourcelink = False

Enable figure numbering. If true, figures, tables and code-blocks are automatically

numbered if they have a caption. The numref role is enabled. Obeyed so far only by

HTML and LaTeX builders. Default is False.

num_fig = True

Build Command

sphinx-build -b html docs/source docs/build

System Info:

  • OS: Windows 10 Pro, 22H2
  • MyST-Markdown: v0.11.0
  • VSCode: 1.95.3

MyST-Markdown (Previewer)

image

Sphinx Build

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions