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

Use mkdocs 1.2.1 #327

Closed
wants to merge 3 commits into from
Closed

Use mkdocs 1.2.1 #327

wants to merge 3 commits into from

Conversation

madwort
Copy link
Contributor

@madwort madwort commented Jul 15, 2021

I suspect that upgrading mkdocs & mkdocstrings at the same time might fix CI - let's see.

dependabot bot added 2 commits July 15, 2021 14:55
Bumps [mkdocs](https://github.com/mkdocs/mkdocs) from 1.1.2 to 1.2.1.
- [Release notes](https://github.com/mkdocs/mkdocs/releases)
- [Commits](mkdocs/mkdocs@1.1.2...1.2.1)

---
updated-dependencies:
- dependency-name: mkdocs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) from 0.13.6 to 0.15.2.
- [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases)
- [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/master/CHANGELOG.md)
- [Commits](mkdocstrings/mkdocstrings@0.13.6...0.15.2)

---
updated-dependencies:
- dependency-name: mkdocstrings
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@madwort madwort changed the title Madwort/mkdocs 1.2.1 Use mkdocs 1.2.1 Jul 15, 2021
@madwort madwort self-assigned this Jul 15, 2021
@cloudflare-pages
Copy link

cloudflare-pages bot commented Jul 15, 2021

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2fbba42
Status:🚫  Build failed.

View logs

@StevenMaude
Copy link
Contributor

StevenMaude commented Jul 15, 2021

To solve that problem, add

site_url: https://docs.opensafely.org

in mkdocs.yml

Then this will result in:

  File "templates/python/material/parameters.html", line 14, in top-level template code
    <td>{{ parameter.description|convert_markdown }}</td>
TypeError: do_convert_markdown() missing 1 required positional argument: 'heading_level'

Which I don't understand why it's required yet:

https://github.com/mkdocstrings/mkdocstrings/blob/87c55fb07cb54e9899c4dee7070da38d6a9ce797/src/mkdocstrings/handlers/base.py#L141

@madwort
Copy link
Contributor Author

madwort commented Jul 15, 2021

thanks, added a separate mkdocs.test.yml, because I wanted to avoid breaking links on the cloudflare test deploys - it gives the error that the mkdocstring pr gives on its own, though - maybe we can fix that there & do mkdocs-1.2 afterwards

@StevenMaude
Copy link
Contributor

StevenMaude commented Jul 20, 2021

This is all resolved now via #332 and #333. In mkdocs 1.2.1 there was a requirement to specify site_url: this requirement was removed in 1.2.2.


NB: site_url is to specify a canonical URL. We possibly wouldn't want https://docs.opensafely.org as site_url for local builds or Cloudflare Pages previews, but only for the deployed site.

Cloudflare Pages lets you discern production from non-production branches. If we wanted to do this, I think it would be possible via:

  1. Add a script/make target, or similar, to launch mkdocs build --strict.
  2. In that wrapper around mkdocs build --strict, check if the Cloudflare Pages-specific environment variableCF_PAGES_BRANCH — is main.
  3. If the branch is main then set a SITE_URL (or similar) environment variable to https://docs.opensafely.org
  4. In mkdocs.yml, specify site_name: !ENV SITE_URL — see the mkdocs documentation. If the SITE_URL environment variable is not set, then restore the default.

Alternatively, if it's possible to set custom environment variables for testing and production within Cloudflare Pages, then that would remove the need for the wrapper: we'd just need the !ENV SITE_URL in mkdocs.yml.

@StevenMaude StevenMaude deleted the madwort/mkdocs-1.2.1 branch July 20, 2021 11:42
@madwort
Copy link
Contributor Author

madwort commented Jul 21, 2021

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants