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

docs: Reworks documentation to use mkdocs #1079

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

ns-rse
Copy link
Collaborator

@ns-rse ns-rse commented Jan 22, 2025

Closes #175

On the back of positive feedback on the AFMReader website in todays
Code Clean I got stuck in refactoring the code to use mkdocs.

Not quite there yet as the following need addressing.

  • versioning is configured but not
    used. This may be my misunderstanding of how the extension is meant to work as I thought it would make new sites for
    each version. Reading the mike documentation this may not be the case and it may
    require a one-off task of sitting down and going through building documentation on the gh-pages branch locally for
    each version we wish to provision documentation for.
  • syntax highlighting is again configured but
    not working/used when the site is rendered. Need to work out why.
  • expanding menus - these work when using the material theme without any action but don't when using the terminal
    theme which the team liked.

To test this out locally you can...

git switch main
git pull
git checkout ns-rse/1075-mkdocs
pip install -e .[docs]
mkdocs serve

...and got to the URL output in the terminal.


  • Documentation has been updated and builds. Remember to update as required...

@ns-rse
Copy link
Collaborator Author

ns-rse commented Jan 28, 2025

I've explicitly ignored the OT string in the Mermaid diagram.

The other pre-commit error rises from the check-yaml hook not being able to recognise a constructor for the entry required in mkdocs.yaml to ring fence the Mermaid diagram (required to get it to render correctly).

I can't see any method of ignoring this individual line as the pre-commit set of hooks operate on a per-file basis. We could add exclude: [ "mkdocs.yml" ] (or similar) but then lose the benefit of having the rest of the syntax checked in this file so I'd rather just accept that pre-commit will always fail on that one line as in theory it should only be run against that file when it is modified (I'll keep an eye on this and if its repeatedly failing will exclude it).

@ns-rse
Copy link
Collaborator Author

ns-rse commented Feb 3, 2025

Reading through the documentation for mike, the Mkdocs extension that builds and
manages multiple versions of documentation it looks like we will have to use...

mike depoly [version]

...to build documentation for older versions/releases. It is a little unclear but it is stated that it will
update versions of documentation on the gh-pages branch and
suggests that existing versions should be deleted first.

Currently though we don't have any versions released with mkdocs on the gh-pages branch since we have been using
sphinx-multiversion to build and deploy.

I think a useful strategy would therefore be to merge this pull request which will trigger building and deployment of
the documentation using mkdocs. We can then undertake manually building the documentation for the versions we
currently have available which are...

  • v2.0.0
  • v2.1.0
  • v2.1.1
  • v2.1.2
  • v2.2.0
  • v2.2.1
  • v2.2.post0
  • v2.3.1
  • main

...and have these manually uploaded. Probably not quite as straight-forward as it sounds but would be useful to get
these updated.

Closes #175

On the back of approval in todays Code Clean I got stuck in refactoring the code to use [mkdocs](https://mkdocs.org).

Not quite there yet as the following need addressing.

- [versioning](https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/) is configured but not
  used. This may be my misunderstanding of how the extension is meant to work as I thought it would make new sites for
  each version. Reading the [mike documentation](https://github.com/jimporter/mike) this may not be the case and it may
  require a one-off task of sitting down and going through building documentation on the `gh-pages` branch locally for
  each version we wish to provision documentation for.
- [syntax highlighting](https://ntno.github.io/mkdocs-terminal/configuration/code-highlighting/) is again configured but
  not working/used when the site is rendered. Need to work out why.
- expanding menus - these work when using the `material` theme without any action but don't when using the `terminal`
  theme which the team liked.
- Fixes some internal links that were wrong
- Adds a page on Matplotlib Style
- Tweaks advice in `topostats/topostats.mplstyle` on usage
- Adds `--unsafe` flat to `check-yaml` pre-commit hook so it doesn't complain about Mermaid config in `mkdocs.yaml`
@ns-rse ns-rse force-pushed the ns-rse/1075-mkdocs branch from 9ce315f to 2c299ae Compare February 3, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant