diff options
| author | 2024-02-03 00:50:43 -0800 | |
|---|---|---|
| committer | 2024-02-03 00:50:43 -0800 | |
| commit | ad2410ef24e97742bc22f0d8775a0f37a5bf2db5 (patch) | |
| tree | cce3c380e6b695d11dcb65ee65411f6f654e2be3 /pydis_site/apps/content | |
| parent | Migrate mailing lists to their own API endpoints (diff) | |
| parent | Merge pull request #1220 from python-discord/dependabot/pip/ruff-0.2.0 (diff) | |
Merge branch 'main' into mailing-list-model
Diffstat (limited to 'pydis_site/apps/content')
4 files changed, 36 insertions, 11 deletions
diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md index b36c0afd..5dc6408c 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing.md @@ -9,8 +9,8 @@ Our projects on Python Discord are open source and [available on GitHub](https:/  <!-- Project cards -->  <div class="columns is-multiline is-centered is-3 is-variable">    <div class="column is-one-third-desktop is-half-tablet"> -    <div class="card github-card"> -      <div class="card-header"> +    <div class="card github-card has-background-white"> +      <div class="card-header has-background-white">          <div class="card-header-title is-centered">            <a class="is-size-5" href="https://github.com/python-discord/sir-lancebot">              <i class="fab fa-github"></i> <strong >Sir Lancebot</strong> @@ -22,11 +22,11 @@ Our projects on Python Discord are open source and [available on GitHub](https:/            Sir Lancebot has a collection of self-contained, for-fun features. If you're new to Discord bots or contributing, this is a great place to start!          </div>        </div> -      <div class="card-footer"> +      <div class="card-footer has-background-white">          <a href="https://github.com/python-discord/sir-lancebot/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc" class="card-footer-item"><i class="fas fa-exclamation-circle"></i> Issues</a>          <a href="https://github.com/python-discord/sir-lancebot/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc" class="card-footer-item"><i class="fas fa-code-merge"></i> PRs</a>        </div> -      <div class="card-footer"> +      <div class="card-footer has-background-white">          <a href="/pages/guides/pydis-guides/contributing/sir-lancebot" class="card-footer-item"><i class="fas fa-cogs"></i> Setup and Configuration Guide</a>        </div>      </div> diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md b/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md index 65a402fd..8470a6c1 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/how-to-contribute-a-page.md @@ -85,6 +85,31 @@ Pages, which include guides, articles, and other static content,...  - **toc:** A number representing the smallest heading tag to show in the table of contents.      See: [Table of Contents](#table-of-contents) +## Working with dark mode + +If your article includes images, you can apply a few classes for a better experience for readers using dark mode. + +### Add a white background to an image + +Use the `has-dark-mode-background` class to apply a white background to your image, so it can be read easily in dark mode. + +```md +{: class="has-dark-mode-background" } +``` + +### Alternate images for each mode + +If you can provide two images, suited for each of the light and dark modes specifically, you can use the `light-image` and `dark-image` classes to have the correct image be used depending on the mode. + +```md +{: class="light-image" } +{: class="dark-image" } +``` + +This way, when the reader is in light mode, only `image_light.png` is shown, and when the reader is in dark mode, only `image_dark.png` is shown. + +All images with `light-image` class are hidden in dark mode and all images with `dark-image` class are hidden in light mode. +  ## Extended Markdown  Apart from standard Markdown, certain additions are available: diff --git a/pydis_site/apps/content/resources/guides/python-guides/mutability.md b/pydis_site/apps/content/resources/guides/python-guides/mutability.md index 185dc87c..e180fd16 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/mutability.md +++ b/pydis_site/apps/content/resources/guides/python-guides/mutability.md @@ -30,11 +30,11 @@ It just returns a new one.  Let's examine what's going on here.  At first, the variable `s` refers to some object, the string `'hello'`. - +{: class="has-dark-mode-background" }  When you call `s.upper()`, a new string, which contains the characters `'HELLO'`, gets created. - +{: class="has-dark-mode-background" }  This happens even if you just call `s.upper()` without any assignment, on its own line:  ```python @@ -44,12 +44,12 @@ In this case, a new object will be created and discarded right away.  Then the assignment part comes in: the name `s` gets disconnected from `'hello'`, and gets connected to `'HELLO'`. - +{: class="has-dark-mode-background" }  Now we can say that `'HELLO'` is stored in the `s` variable.  Then, because no variables refer to the _object_ `'hello'`, it gets eaten by the garbage collector. - +{: class="has-dark-mode-background" }  It means that the memory reserved for that object will be freed. If that didn't happen, the 'garbage' would accumulate over time and fill up all the RAM. diff --git a/pydis_site/apps/content/utils.py b/pydis_site/apps/content/utils.py index cfd73d67..5a146e10 100644 --- a/pydis_site/apps/content/utils.py +++ b/pydis_site/apps/content/utils.py @@ -107,7 +107,7 @@ def fetch_tags() -> list[Tag]:              for file in repo.getmembers():                  if "/bot/resources/tags" in file.path:                      included.append(file) -            repo.extractall(folder, included) +            repo.extractall(folder, included)  # noqa: S202          for tag_file in Path(folder).rglob("*.md"):              name = tag_file.name @@ -206,9 +206,9 @@ def record_tags(tags: list[Tag]) -> None:              # pretend it's previous state is the current state              old_tag = new_tag -        if old_tag.sha == new_tag.sha and old_tag.last_commit is not None: +        if old_tag.sha == new_tag.sha and old_tag.last_commit_id is not None:              # We still have an up-to-date commit entry -            new_tag.last_commit = old_tag.last_commit +            new_tag.last_commit_id = old_tag.last_commit_id          new_tag.save()  |