lukasgeiter / mkdocs-awesome-pages-plugin

An MkDocs plugin that simplifies configuring page titles and their order
MIT License
452 stars 35 forks source link

support for imported repositories (multirepo plugin) #84

Closed andboss closed 10 months ago

andboss commented 10 months ago

We are using the multirepo plugin to import other repositories in the nav section, e.g.

- 'SDK':
  - 'rsc': '!import https://myserver/rsc?branch=main&docs_dir=docs/external/*&config=userdoc_SDK_nav.yml'

After the import we have some pages not included in the nav, because they are autogenerated and many, e.g.:

INFO    -  The following pages exist in the docs directory, but are not included in the "nav" configuration:
- sdk/rsc/doxygen_markdown/Classes/index.md
- sdk/rsc/doxygen_markdown/Classes/classoie_1_1sdk_1_1rsc_1_1Callable.md
- ...
- sdk/rsc/doxygen_markdown/Pages/index.md
- ...

Now we wanted to use the awesome-plugin features as using in other repositories without multirepo with big success, big thanks :)

I just tried a naive approach to add new nav line that collects all the generated stuff:

- 'SDK':
  - 'rsc': '!import https://myserver/rsc?branch=main&docs_dir=docs/external/*&config=userdoc_SDK_nav.yml'
 -  'rsc Doxygen':  '... | sdk/rsc/doxygen_markdown/**'

but as expected we see such warning and it stops in strict mode:

WARNING -  A relative path to '... | sdk/rsc/doxygen_markdown/**' is included in the 'nav' configuration, which is not found in the documentation files.

Is there any possibility to configure it somehow for imported repos / sub-navs?

Thank You!

kamilkrzyskow commented 10 months ago

The warning looks like internal MkDocs to me trying to parse the string as a path.

Try removing the single quotes ' around the value.

Also just try and see what will happen with:

- 'SDK': sdk

What I'm suggesting is to try let awesome pages unfold sdk on its own.

lukasgeiter commented 10 months ago

@andboss Could you please provide a full example that reproduces your problem? Ideally in form of a repo or zip file.

andboss commented 10 months ago

Thanks! We have now adapted the configuration use extra line like documented:

- 'SDK':
  - 'rsc': '!import https://myserver/rsc?branch=main&docs_dir=docs/external/*&config=userdoc_SDK_nav.yml'
  - 'rsc Doxygen':
    -  '... | sdk/rsc/doxygen_markdown/**'

and it works :)

andboss commented 10 months ago

but we have INFO now as it only works with this config order:

  # https://github.com/jdoiro3/mkdocs-multirepo-plugin
  multirepo:
    cleanup: false
    temp_dir: .deps  # add this path to `.gitignore` if `cleanup` is set to `false`
  # https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin
  awesome-pages: {}

and reports INFO about this and also the multirepo detects it as absolute path and luckily ignores

INFO    -  NavPluginOrder: The plugin "multirepo" might not work correctly when placed before awesome-pages in the list of plugins. It defines an on_nav handler that will be overridden by awesome-pages in some circumstances.
  File "/usr/local/lib/python3.11/site-packages/mkdocs/plugins.py", line 507, in run_event
    result = method(item, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/mkdocs_awesome_pages_plugin/plugin.py", line 93, in on_config
    warnings.warn(NavPluginOrder(name))
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /builds/
INFO    -  DeprecationWarning: _filter_paths is not used since MkDocs 1.5 and will be removed soon.
  File "/usr/local/lib/python3.11/site-packages/mkdocs_multirepo_plugin/structure.py", line 4[40](), in get_files
    if _filter_paths(basename=dirname, path=path, is_dir=True, exclude=exclude):
  File "/usr/local/lib/python3.11/site-packages/mkdocs/structure/files.py", line 393, in _filter_paths
    warnings.warn(
INFO    -  An absolute path to '/... | sdk/rsc/doxygen_markdown/**' is included in the 'nav' configuration, which presumably points to an external resource.

i think we can work with this anyway, may be can be analyzed in other issue...

andboss commented 10 months ago

ah sorry both are INFO from multirepo plugin, just ignore my comment :)