Skip to content

projects plugin sub-project watcher for "external" files #6945

@Blacksmoke16

Description

@Blacksmoke16

Context

Description

As per the related discussion, I'm creating this as a feature request so that ideally the projects plugin can be compatible with mkdocs-gen-files.

An example reproduction of this behavior can be seen in mkdocs-testing.zip.

NOTE: This does require https://crystal-lang.org/install/ as it is needed on path in order to generate the intermediary documentation format used by mkdocstrings-crystal.

  1. python3 -m venv venv
  2. . venv/bin/activate
  3. pip install -r requirements.txt
  4. mkdocs serve

From here navigate to the My App project in the nav. And notice you see the docs for class Athena::Foo, along with the #bar method. If you were to go and edit projects/my_app/src/test.cr to remove the fdgfdgfddfg from line 2 and save, you will see it triggers the following, with the browser reloading:

INFO    -  [23:59:58] Detected file changes
INFO    -  Schedule build due to 'projects/my_app/src/test.cr' in '.'
INFO    -  Building documentation...
INFO    -  Documentation built in 0.08 seconds
INFO    -  [23:59:58] Reloading browsers
INFO    -  [23:59:58] Browser connected: http://localhost:8000/my_app/

However you'll notice fdgfdgfddfg is still a part of the docs.

Now if you open your editor to projects/my_app/mkdocs.yml and save that file you'll see when the browser reloads that it now properly reflects your changes in projects/my_app/src/test.cr with the following output:

INFO    -  Schedule build due to 'mkdocs.yml' in 'projects/my_app'
INFO    -  [00:03:30] Detected file changes
INFO    -  Building documentation...
INFO    -  Schedule build due to 'projects/my_app/mkdocs.yml' in '.'
INFO    -  [project://.my_app] Cleaning site directory
INFO    -  [project://.my_app] Building documentation to directory:
           /home/george/downloads/mkdocs-testing/projects/my_app/site
INFO    -  [project://.my_app] Documentation built in 0.26 seconds
INFO    -  Documentation built in 0.46 seconds
INFO    -  [00:03:31] Reloading browsers
INFO    -  [00:03:31] Detected file changes
INFO    -  [00:03:31] Browser connected: http://localhost:8000/my_app/
INFO    -  Building documentation...
INFO    -  Schedule build due to 'projects/my_app/site/assets/_mkdocstrings.css' in '.'
INFO    -  Schedule build due to 'projects/my_app/site/sitemap.xml.gz' in '.'
INFO    -  Schedule build due to 'projects/my_app/site/index.html' in '.'
INFO    -  Schedule build due to 'projects/my_app/site/sitemap.xml' in '.'
INFO    -  Schedule build due to 'projects/my_app/site/404.html' in '.'
INFO    -  [00:03:31] Reloading browsers
INFO    -  [00:03:31] Detected file changes
INFO    -  [00:03:31] Browser connected: http://localhost:8000/my_app/
INFO    -  Building documentation...
INFO    -  [00:03:31] Reloading browsers
INFO    -  [00:03:31] Browser connected: http://localhost:8000/my_app/

The same behavior can be seen if you were to add and edit new doc files within projects/my_app/docs as well. So it seems to me the file watcher events watching docs/ and mkdocs.yml is different than event of "external" files. I.e. non-mkdocs files added to https://www.mkdocs.org/user-guide/configuration/#watch.

Related links

Use Cases

This would make it easier to work on API docs generated from language source code files. Which ultimately provides a good ecosystem to use contextual mkdoc docs along side API docs from the source code.

Visuals

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestIssue requests a new feature or improvementresolved by config changeIssue can be mitigated by the reporter

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions