Skip to content

Adding MkDocs docs to template - #319

Merged
matt-graham merged 25 commits into
mainfrom
mmg/mkdocs-docs
Mar 25, 2024
Merged

Adding MkDocs docs to template#319
matt-graham merged 25 commits into
mainfrom
mmg/mkdocs-docs

Conversation

@matt-graham

Copy link
Copy Markdown
Collaborator

Would resolve #16 as an alternative to #318

Adds MkDocs documentation to template, aiming for a comparable set of features to what is implemented in #318 - automatically built API documentation with Markdown syntax, support for references to external documentation inventories, dark / light mode toggle, GitHub repository link in docs, workflow for automatically testing building docs.

Example screenshot of rendered index page

image

and of API reference page

image

@matt-graham

matt-graham commented Mar 20, 2024

Copy link
Copy Markdown
Collaborator Author

I got a not very helpful SyntaxError: All collection items must start at the same column (1:1) error from prettier when first trying to commit the mkdocs.yml file which was eventually resolved by some trial and error of adding additional quotation marks around some of the string values.

If we're going the MkDocs route, I would say we might want to review use of Prettier for YAML files as I can imagine the experience for users of getting a message like this when trying to commit changes to mkdocs.yml would be a bit painful.

Prettier output
[error] {{cookiecutter.project_slug}}/mkdocs.yml: SyntaxError: All collection items must start at the same column (1:1)
[error] >  1 | site_name: {{cookiecutter.project_name}}
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  2 | site_description: Documentation website for {{cookiecutter.project_name}}
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  3 | site_author: {{cookiecutter.author_given_names}} {{cookiecutter.author_family_names}}
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  4 | copyright: © {% now 'utc', '%Y' %}, {{cookiecutter.author_given_names}} {{cookiecutter.author_family_names}}
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  5 | repo_url: https://github.com/{{cookiecutter.github_username}}/{{cookiecutter.project_slug}}/
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  6 | repo_name: {{cookiecutter.github_username}}/{{cookiecutter.project_slug}}
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  7 |
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  8 | theme:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] >  9 |   name: "material"
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 10 |   palette:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 11 |     - media: "(prefers-color-scheme)"
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 12 |       toggle:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 13 |         icon: material/brightness-auto
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 14 |         name: Switch to light mode
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 15 |     - media: "(prefers-color-scheme: light)"
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 16 |       scheme: default
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 17 |       toggle:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 18 |         icon: material/brightness-7
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 19 |         name: Switch to dark mode
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 20 |     - media: "(prefers-color-scheme: dark)"
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 21 |       scheme: slate
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 22 |       toggle:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 23 |         icon: material/brightness-4
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 24 |         name: Switch to system preference
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 25 |   icon:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 26 |     repo: fontawesome/brands/github
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 27 |
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 28 | nav:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 29 |   - index.md
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 30 |   - api.md
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 31 |
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 32 | plugins:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 33 |   - search
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 34 |   - mkdocstrings:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 35 |       default_handler: python
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 36 |       handlers:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 37 |         python:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 38 |           docstring_style: google
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 39 |           import:
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 40 |           - https://docs.python.org/3/objects.inv
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 41 |           paths: [src]
[error]      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] > 42 |
[error]      |

@matt-graham
matt-graham marked this pull request as draft March 20, 2024 19:27
@matt-graham matt-graham mentioned this pull request Mar 20, 2024
@paddyroddy

Copy link
Copy Markdown
Member

If we're going the MkDocs route, I would say we might want to review use of Prettier for YAML files as I can imagine the experience for users of getting a message like this when trying to commit changes to mkdocs.yml would be a bit painful.

I do think a lot of the difficulties arise from cookiecutter templating in the files. We may need to exclude stuff at the top level .pre-commit-config.yaml - as is done in other hooks.

@paddyroddy paddyroddy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we go with this approach, I have given a review.

Comment thread {{cookiecutter.project_slug}}/docs/LICENSE.md Outdated
Comment thread {{cookiecutter.project_slug}}/docs/index.md Outdated
Comment thread {{cookiecutter.project_slug}}/pyproject.toml Outdated
Comment thread {{cookiecutter.project_slug}}/mkdocs.yml
Comment thread {{cookiecutter.project_slug}}/pyproject.toml Outdated
Comment thread {{cookiecutter.project_slug}}/.github/workflows/docs.yml Outdated
Comment thread {{cookiecutter.project_slug}}/.github/workflows/docs.yml
Comment thread {{cookiecutter.project_slug}}/.github/workflows/docs.yml Outdated
@matt-graham
matt-graham marked this pull request as ready for review March 22, 2024 17:42
@matt-graham matt-graham mentioned this pull request Mar 22, 2024
4 tasks
Comment thread cookiecutter.json

@samcunliffe samcunliffe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for dual-wielding the docs builds!

Comment thread {{cookiecutter.project_slug}}/.github/workflows/docs.yml
Comment thread {{cookiecutter.project_slug}}/README.md Outdated
Comment thread {{cookiecutter.project_slug}}/docs/api.md
samcunliffe added a commit that referenced this pull request Mar 24, 2024
Fixes #187.
Relates to #16, #318, and #319. See discussion in #16.
Depends on #319.
Co-authored-by: Sam Cunliffe <samcunliffe@users.noreply.github.com>

@paddyroddy paddyroddy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@matt-graham
matt-graham merged commit 925fce9 into main Mar 25, 2024
@matt-graham
matt-graham deleted the mmg/mkdocs-docs branch March 25, 2024 11:33
@samcunliffe samcunliffe mentioned this pull request Mar 25, 2024
22 tasks
samcunliffe added a commit that referenced this pull request Mar 25, 2024
Following the discussion in #16, I've tried to summarise (and might have
quoted you directly 😄). Picky comments very gratefully received.

## Fixes
- #187

## Relates to
- #16
- #318
- #319

---------

Co-authored-by: Matt Graham <matthew.m.graham@gmail.com>
Co-authored-by: David Stansby <dstansby@gmail.com>
matt-graham added a commit that referenced this pull request Jun 5, 2024
Fixes #296 and fixes #305 

Adds longer human-readable prompts for all cookiecutter template options
using the `prompts` field in `cookiecutter.json` (we already had a
prompt for `deploy_docs_to_github_pages` option from #319).

---------

Co-authored-by: David Stansby <dstansby@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation

3 participants