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

Adding projects from submodules leads to some incompatibilities with plugins #6970

Closed
4 tasks done
leandrolerena opened this issue Mar 25, 2024 · 5 comments
Closed
4 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@leandrolerena
Copy link
Sponsor

Context

I use the projects plugin to evaluate mkdocs for a documentation project. Therefore, I need documentation to be aggregated from different repositories.

In particular, I have two issues, one with git-authors, the other with pymdownx.snippets, which make me wonder if the following statement:

Since the projects plugin will invoke local builds in the directory of where your submodules are located, this plugin should work without problems, as it does not use temporary directories.

as the local build works perfectly.

See discussion on git-authors here: timvink/mkdocs-git-authors-plugin#79

Bug description

git-authors plugin reports the following on the project included:

WARNING -  [project://.zebbra-mkdocs-dummyproject] [git-authors-plugin] /home/USER/projects/zebbra-mkdocs/submodules/zebbra-mkdocs-dummyproject/docs/index.md has not
           been committed yet. Lines are not counted
...

pymdownx.snippets do not work

Related links

Reproduction

reproduction.zip

Steps to reproduce

  1. Clone https://github.com/zebbra/zebbra-mkdocs/tree/mkdocs_projects (make sure the branch is mkdocs_projects, as I am testing different approaches)
  2. git submodule init
  3. git submodule update
  4. pipenv install
  5. make serve

This will reproduce the error from snippets, you can remove the snippets by clearing the file content in submodules/zebbra-mkdocs-dummyproject/docs/index.md

  1. Open in browser
  2. Click on Test in the navigation (this will lead to the project included with the plugin)
  3. Observe that git authors are empty)

Browser

No response

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting. @alexvoss I'm pretty sure this is related to the cwd issue you encountered. We'll look into it, but please understand that it might take some time – it is tricky to fix and will require us to rewrite some things, but I agree that this should definitely work.

@squidfunk squidfunk added the bug Issue reports a bug label Mar 25, 2024
@leandrolerena
Copy link
Sponsor Author

Thanks for looking into it. I totally understand. Feel free to ping me to test it!

@squidfunk
Copy link
Owner

Thanks for reporting. Fixed in f2f919c. The projects plugin will now set the current working directory to the directory the mkdocs.yml is located in and build the project from there. This should resolve all known issues with relative paths used in plugins and extensions when using the projects plugin.

There's a problem with your reproduction however that makes it crash regardless whether you're using the projects plugin or not. Snippets are stored inside docs, but the path is incorrect in index.md:

...
Reference the whole python file 

```python
--8<-- "dummyproject-snippets/local.py"      # <- incorrect 
--8<-- "docs/dummyproject-snippets/local.py" # <- correct
```
...

After prepending docs/ to both local.py snippet URLs, the build succeeds with and without the plugin.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Apr 5, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.17+insiders-4.53.6.

@leandrolerena
Copy link
Sponsor Author

Thanks @squidfunk , that was a lot faster than anticipated!

And yes, even though the reproduction works on my side, it contains a nasty hack to circumvent an issue with paths for snippets (duplicate paths) which you just fixed.

I'll be happy to test everything in a clean environment. Have a good start into the week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants