deepmodeling / deepmodeling/deepmodeling_sphinx

[Code scan] Copy dark_rtd.css when it is registered with sphinx_rtd_theme

Open
#83 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
2
Forks
6
PR merge metrics
No merged PRs in 30d

Description

This issue is a result of a Codex global code scan of deepmodeling/deepmodeling_sphinx at commit 156679fe55fc61e8ec3b1e9be8a45fde3567b9cb.

Problem

When `enable_deepmodeling = False` and `html_theme = "sphinx_rtd_theme"`, the extension still registers `dark_rtd.css`, but `copy_custom_files()` returns before copying package assets. The generated HTML can reference `_static/dark_rtd.css` even though the file is absent.

Code references:

https://github.com/deepmodeling/deepmodeling_sphinx/blob/156679fe55fc61e8ec3b1e9be8a45fde3567b9cb/deepmodeling_sphinx/inject.py#L38-L51
https://github.com/deepmodeling/deepmodeling_sphinx/blob/156679fe55fc61e8ec3b1e9be8a45fde3567b9cb/deepmodeling_sphinx/inject.py#L174-L177

Reproduction

Use a minimal Sphinx project with:

```py
extensions = ["deepmodeling_sphinx"]
html_theme = "sphinx_rtd_theme"
enable_deepmodeling = False
```

The generated page includes `_static/dark_rtd.css`, but `_static/dark_rtd.css` is not copied to the output directory.

Impact

Projects that disable DeepModeling-specific banner styling can still emit a broken stylesheet reference when using the RTD theme.

Suggested fix

Either skip `app.add_css_file("dark_rtd.css")` when `enable_deepmodeling` is false, or copy `dark_rtd.css` independently from the banner assets.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.