Code Monkey home page Code Monkey logo

Comments (16)

naor2013 avatar naor2013 commented on June 18, 2024 1

@2bndy5 Can you open a PR to fix it?

from sphinx-immaterial.

jbms avatar jbms commented on June 18, 2024

There is existing code intended to prevent references to material.css being added. It sounds like that is not working for you?

from sphinx-immaterial.

naor2013 avatar naor2013 commented on June 18, 2024

Let me know how can I test it or what shall I try.
The material.css file does not exist but the html references it.
When I tried to remove the html references to material.css, the result site looked empty, like it's html without any css at all.

from sphinx-immaterial.

jbms avatar jbms commented on June 18, 2024

You have to add sphinx_immaterial as an extension, in addition to using it as your theme.

Refer to docs/conf.py for details.

from sphinx-immaterial.

naor2013 avatar naor2013 commented on June 18, 2024

That did solve the material.css problem but now it causes a new problem that _static/documentation_options.js is missing.
Also, the site still looks like it lacks any formatting at all, it just looks like an html file with no css.

from sphinx-immaterial.

naor2013 avatar naor2013 commented on June 18, 2024

@jbms Let me know what I should change or test :)

from sphinx-immaterial.

jbms avatar jbms commented on June 18, 2024

Can you describe exactly how to build your documentation/reproduce the problem you are seeing, starting from an empty virtualenv?

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

I think I accidentally reproduced this... I opened the uploaded docs (from saved artifacts of my "build docs" CI workflow), and the html files don't use any styling at all

docs.zip

The styling does show in the published gh-pages though. I switched my docs/conf.py from your fork of sphinx-material to this repo, and the styling no longer is applied.

From generated index.html

    <link rel="stylesheet" type="text/css" href="_static/material.css" />

However, there was no material.css in the _static folder

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

this also happens when building the docs for this repo. Albeit, I get a lot of warnings about missing stub files for numpy.polynomial.Polynomial class

path/to/Documents/GitHub/env/lib/python3.8/site-packages/numpy/polynomial/polynomial.py:docstring of numpy.polynomial.polynomial.Polynomial:42: WARNING: autosummary: stub file not found 'numpy.polynomial.Polynomial.__call__'. Check your autosummary_generate setting.

but that may be a problem with numpy v1.21 (looks like they're somewhat aware of it)

from sphinx-immaterial.

naor2013 avatar naor2013 commented on June 18, 2024

@2bndy5 The material.css is solved by adding "sphinx_immaterial" as an extension.
I have a different issue now, explained in my comment above.

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

Ok I added it to the extensions list, I'm already using it as my theme, but the material.css still does not exist. In fact, I don't even see the following line in my index.html anymore.

    <link rel="stylesheet" type="text/css" href="_static/material.css" />

@jbms incremental builds is working now - I don't get that error about the search cache. Not sure if that's intended or a maybe clue. EDIT I can do incremental builds with my test docs but this repo's docs still output

Exception occurred:
  File "/path/to/env/lib/python3.8/site-packages/sphinx/search/__init__.py", line 283, in load
    index2fn = frozen['docnames']
KeyError: 'docnames'

from sphinx-immaterial.

naor2013 avatar naor2013 commented on June 18, 2024

@2bndy5 I think material.css shouldn't exist so now you have it working as intended (that's what I understood at least.)
Do you have the other bug I wrote about (with the documentation_options.js) or is that working for you now?

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

Do you have the other bug I wrote about (with the documentation_options.js) or is that working for you now?

yes. I see it specified in index.html

  <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>

but it doesn't exist in docs/_build/_static

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

@naor2013 just in case you missed the question, I'll quote it again (for completeness)

Can you describe exactly how to build your documentation/reproduce the problem you are seeing, starting from an empty virtualenv?

I'm currently doing

cd docs
pip install -r requirements.txt
sphinx-build . _build

where my docs/requirements.txt contains

git+https://github.com/jbms/sphinx-immaterial
sphinx-copybutton
and conf.py contains
sys.path.insert(0, os.path.abspath(".."))

extensions = [
    "sphinx.ext.autosummary",
    "sphinx.ext.autodoc",
    "sphinx.ext.intersphinx",
    "sphinx.ext.napoleon",
    "sphinx.ext.todo",
    "sphinx.ext.viewcode",
    "sphinx.ext.graphviz",
    "sphinx_copybutton",
    # "rst2pdf.pdfbuilder",  # for local pdf builder support
    "sphinx_immaterial"
]

html_theme = "sphinx_immaterial"
# Material theme options

html_theme_options = {
    "features": [
        "navigation.expand",
        # 'navigation.tabs',
        # "toc.integrate",
        "navigation.sections",
        "navigation.instant",
        # 'header.autohide',
        "navigation.top",
        # 'search.highlight',
        # 'search.share',
    ],
    "palette": [
        {
            "media": "(prefers-color-scheme: dark)",
            "scheme": "slate",
            "primary": "green",
            "accent": "light blue",
            "toggle": {
                "icon": "material/lightbulb",
                "name": "Switch to light mode",
            },
        },
        {
            "media": "(prefers-color-scheme: light)",
            "scheme": "default",
            "primary": "green",
            "accent": "light blue",
            "toggle": {
                "icon": "material/lightbulb-outline",
                "name": "Switch to dark mode",
            },
        },
    ],
    "repo_url": "https://github.com/2bndy5/check-python-sources/",
    "repo_name": "check-python-sources",
    "repo_type": "github",
    "globaltoc_depth": -1,
    "globaltoc_collapse": False,
    "globaltoc_includehidden": True,
}
html_title = "check-python-sources Github Action"
html_static_path = ["_static"]
html_favicon = "_static/favicon.png"

htmlhelp_basename = "check_python_sources_action_doc"
# html_copy_source = True
# html_show_sourcelink = True

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

So, I found out that the following folders are generated at build-time:

  1. sphinx_immaterial\static\javascripts
  2. sphinx_immaterial\static\stylesheets

but they aren't installed (like they were on the sphinx-material fork) with the rest of the theme.

@naor2013 you're right that material.css is not supposed to exist. Rather, the css that should be <link>-ed from the html is something like main.<ver or short sha>.min.css (there's also an accompanied .map file).

I'm determined to keep investigating, but it looks like there's a lot about nodejs that I have to learn going forward.

from sphinx-immaterial.

2bndy5 avatar 2bndy5 commented on June 18, 2024

Found out that the setuptools.setup() parameter include_package_data=True is geared towards VCS data. I think since all the minified assets are specified in .gitignore file, they weren't getting copied over during install. I commented it out and the theme.conf stop getting copied over (which wasn't specified in .gitignore). I went further and manually specified the theme.conf & minified assets as extra package data like so

setuptools.setup(
    # ...
    packages=["sphinx_immaterial"],
    package_dir={"sphinx_immaterial": "sphinx_immaterial"},
    package_data={
        "sphinx_immaterial": [
            ".icons/*/**",
            ".icons/*/*/**",
            "partials/*.html",
            "partials/*/*.html",
            "partials/*/*/*.html",
            "partials/*/*/*/*.html",
            "static/*/**",
            "*.html",
            "theme.conf"
        ]
    },
    # include_package_data=True,  # doesn't handle gitignored stuff at all
)

This put the proper files in with the installed pkg. Built the my docs again, and we're back in business!

from sphinx-immaterial.

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.