From 04bca458f14c1d78c511820a79d13e7b04b60f20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Eertmans?=
Date: Wed, 17 Apr 2024 17:59:40 +0200
Subject: [PATCH] chore(ci): checking links and spell checking (#417)
* chore(ci): checking links and spell checking
* chore(ci): move markdown-link-check to GitHub ci
Because pre-commit.ci does not have access to the internet...
* fix(lib): revert `reverse-...` utils because of warnings
* chore(ci): checking links and spell checking
* chore(ci): move markdown-link-check to GitHub ci
Because pre-commit.ci does not have access to the internet...
* fix(docs): myst-parser xref cannot end with .html
* fix(docs): oops
---
.bumpversion.cfg | 2 +-
.github/scripts/check_github_issues.py | 27 ++++++++++++++++++++++++++
.github/workflows/tests.yml | 15 +++++++++++++-
.mdlc.json | 8 ++++++++
.pre-commit-config.yaml | 14 +++++++++++++
CHANGELOG.md | 8 +++++++-
README.md | 8 ++++----
docs/source/_static/template.html | 2 +-
docs/source/contributing/index.md | 4 ++--
docs/source/contributing/workflow.md | 8 +++++---
docs/source/index.md | 2 +-
docs/source/installation.md | 9 ++++++---
docs/source/quickstart.md | 5 +++--
docs/source/reference/gui.md | 5 +++--
docs/source/reference/html.md | 4 ++--
docs/source/reference/index.md | 18 ++++++++---------
docs/source/reference/sharing.md | 9 +++++++--
manim_slides/config.py | 6 +++++-
manim_slides/convert.py | 4 ++--
manim_slides/present/player.py | 2 +-
manim_slides/templates/revealjs.html | 2 +-
manim_slides/utils.py | 2 +-
paper/paper.md | 8 ++++----
pyproject.toml | 6 ++++++
24 files changed, 134 insertions(+), 44 deletions(-)
create mode 100644 .github/scripts/check_github_issues.py
create mode 100644 .mdlc.json
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 8ddca2a..7f7299b 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,7 +1,7 @@
[bumpversion]
current_version = 5.1.4
parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-rc(?P\d+))?
-serialize =
+serialize =
{major}.{minor}.{patch}-rc{release}
{major}.{minor}.{patch}
commit = True
diff --git a/.github/scripts/check_github_issues.py b/.github/scripts/check_github_issues.py
new file mode 100644
index 0000000..c659769
--- /dev/null
+++ b/.github/scripts/check_github_issues.py
@@ -0,0 +1,27 @@
+"""Check that GitHub issues (and PR) links match the number in Markdown link."""
+
+import glob
+import re
+import sys
+
+if __name__ == "__main__":
+ p = re.compile(
+ r"\[#(?P[0-9]+)\]"
+ r"\(https://github\.com/"
+ r"(?:[a-zA-Z0-9_-]+)/(?:[a-zA-Z0-9_-]+)/"
+ r"(?:(?:issues)|(?:pull))/(?P[0-9]+)\)"
+ )
+
+ ret_code = 0
+
+ for glob_pattern in sys.argv[1:]:
+ for file in glob.glob(glob_pattern, recursive=True):
+ with open(file) as f:
+ for i, line in enumerate(f):
+ for m in p.finditer(line):
+ if m.group("number1") != m.group("number2"):
+ start, end = m.span()
+ print(f"{file}:{i}: ", line[start:end], file=sys.stderr) # noqa: T201
+ ret_code = 1
+
+ sys.exit(ret_code)
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 22aaea9..a58fed7 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -46,7 +46,7 @@ jobs:
if: matrix.os == 'windows-latest'
run: echo "${HOME}/.local/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- # OS depedencies
+ # OS dependencies
- name: Install manim dependencies on MacOS
if: matrix.os == 'macos-latest'
run: brew install ffmpeg py3cairo
@@ -86,3 +86,16 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true
+
+ markdown-link-check:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Check links
+ uses: gaurav-nelson/github-action-markdown-link-check@v1
+ with:
+ use-quiet-mode: yes
+ use-verbose-mode: yes
+ config-file: .mdlc.json
diff --git a/.mdlc.json b/.mdlc.json
new file mode 100644
index 0000000..7055d90
--- /dev/null
+++ b/.mdlc.json
@@ -0,0 +1,8 @@
+{
+ "replacementPatterns": [
+ {
+ "pattern": "^/(?.*)$",
+ "replacement": "https://eertmans.be/manim-slides/latest/$.html"
+ }
+ ]
+}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9718759..eba6aa3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -29,3 +29,17 @@ repos:
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools]
+- repo: https://github.com/codespell-project/codespell
+ rev: v2.2.6
+ hooks:
+ - id: codespell
+ additional_dependencies:
+ - tomli
+- repo: local
+ hooks:
+ - id: github-issues
+ name: GitHub issues link check
+ description: Check issues (and PR) links are matching number.
+ entry: python .github/scripts/check_github_issues.py
+ language: system
+ types: [markdown]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca55f87..dfbc6a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(unreleased)=
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.1.4...HEAD)
+(unreleased-chore)=
+### Chore
+
+- Added CI for broken HTML links and fixed, plus spell checking.
+ [#417](https://github.com/jeertmans/manim-slides/pull/417)
+
(v5.1.4)=
## [v5.1.4](https://github.com/jeertmans/manim-slides/compare/v5.1.3...v5.1.4)
@@ -191,7 +197,7 @@ In an effort to better document changes, this CHANGELOG document is now created.
but the new player should be much easier to maintain and more performant,
than its predecessor.
[#243](https://github.com/jeertmans/manim-slides/pull/243)
-- Changed the slide config format to exclude unecessary information.
+- Changed the slide config format to exclude unnecessary information.
`StypeType` is removed in favor to one boolean `loop` field. This is
a **breaking change** and one should re-render the slides to apply changes.
[#243](https://github.com/jeertmans/manim-slides/pull/243)
diff --git a/README.md b/README.md
index d670797..ef35cbe 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ for detailed install instructions.
Using Manim Slides is a two-step process:
1. Render animations using `Slide` (resp. `ThreeDSlide`) as a base class instead
of `Scene` (resp. `ThreeDScene`), and add calls to `self.next_slide()`
- everytime you want to create a new slide.
+ every time you want to create a new slide.
2. Run `manim-slides` on rendered animations and display them like a
*PowerPoint* presentation.
@@ -57,7 +57,7 @@ The documentation is available [online](https://eertmans.be/manim-slides/).
### Basic Example
-Call `self.next_slide()` everytime you want to create a pause between
+Call `self.next_slide()` every time you want to create a pause between
animations, and `self.next_slide(loop=True)` if you want the next slide to loop
over animations until the user presses continue:
@@ -118,7 +118,7 @@ manim-slides BasicExample
For detailed usage documentation, run `manim-slides --help`, or go to the
-[documentation](https://eertmans.be/manim-slides/reference/cli.html).
+[documentation](https://eertmans.be/manim-slides/latest/reference/cli.html).
## Interactive Tutorial
@@ -170,7 +170,7 @@ in *Settings*->*Display*.
## Contributing
Contributions are more than welcome! Please read through
-[our contributing section](https://eertmans.be/manim-slides/contributing/index.html).
+[our contributing section](https://eertmans.be/manim-slides/latest/contributing/index.html).
### Reporting an Issue
diff --git a/docs/source/_static/template.html b/docs/source/_static/template.html
index 40f0192..c32e335 100644
--- a/docs/source/_static/template.html
+++ b/docs/source/_static/template.html
@@ -261,7 +261,7 @@
mouseWheel: {{ mouse_wheel }},
// Opens links in an iframe preview overlay
- // Add `data-preview-link` and `data-preview-link="false"` to customise each link
+ // Add `data-preview-link` and `data-preview-link="false"` to customize each link
// individually
previewLinks: {{ preview_links }},
diff --git a/docs/source/contributing/index.md b/docs/source/contributing/index.md
index fc99e12..15092c4 100644
--- a/docs/source/contributing/index.md
+++ b/docs/source/contributing/index.md
@@ -18,10 +18,10 @@ workflow
internals
```
-[Workflow](./workflow)
+[Workflow](/contributing/workflow)
: how to work on this project. Start here if you're a new contributor.
-[Internals](./internals)
+[Internals](/contributing/internals)
: how Manim Slides is built and how the various parts of it work.
## Reporting an Issue
diff --git a/docs/source/contributing/workflow.md b/docs/source/contributing/workflow.md
index da3c3b9..266a45c 100644
--- a/docs/source/contributing/workflow.md
+++ b/docs/source/contributing/workflow.md
@@ -18,7 +18,9 @@ Useful links:
* [GitHub's Hello World](https://docs.github.com/en/get-started/quickstart/hello-world).
* [GitHub Pull Request in 100 Seconds](https://www.youtube.com/watch?v=8lGpZkjnkt4&ab_channel=Fireship).
-Once you feel comfortable with git and GitHub, [fork](https://github.com/jeertmans/manim-slides/fork) the repository, and clone it locally.
+Once you feel comfortable with git and GitHub,
+[fork](https://github.com/jeertmans/manim-slides/fork)
+the repository, and clone it locally.
As for every Python project, using virtual environment is recommended to avoid
conflicts between modules.
@@ -36,7 +38,7 @@ pdm install
This, however, only installs the minimal set of dependencies to run the package.
If you would like to install Manim or ManimGL,
-as documented in the [quickstart](../quickstart),
+as documented in the [quickstart](/quickstart),
you can use the `-G|--group` option:
```bash
@@ -45,7 +47,7 @@ pdm install -Gmanim # For Manim
pdm install -Gmanimgl # For ManimGL
```
-Additionnally, Manim Slides comes with groups of dependencies for development purposes:
+Additionally, Manim Slides comes with groups of dependencies for development purposes:
```bash
pdm install -Gdev # For linters and formatters
diff --git a/docs/source/index.md b/docs/source/index.md
index d8a2f46..94922e1 100644
--- a/docs/source/index.md
+++ b/docs/source/index.md
@@ -23,7 +23,7 @@ og:description: Manim Slides makes creating slides with Manim super easy!
Manim Slides makes creating slides with Manim super easy!
-In a [very few steps](./quickstart),
+In a [very few steps](/quickstart),
you can create slides and present them either using the GUI, or your browser.
Slide through the demo below to get a quick glimpse on what you can do with
diff --git a/docs/source/installation.md b/docs/source/installation.md
index a6c967b..8192832 100644
--- a/docs/source/installation.md
+++ b/docs/source/installation.md
@@ -12,7 +12,7 @@ The benefit of using pipx is that it will automatically create a new virtual
environment for every package you install.
:::{note}
-Everytime you read `pipx install`, you can use `pip install` instead,
+Every time you read `pipx install`, you can use `pip install` instead,
if you are working in a virtual environment or else.
:::
@@ -146,23 +146,26 @@ If you are using Nix or NixOS, you can find Manim Slides under:
any Qt bindings.
You can try out the Manim Slides package with
+
```sh
nix-shell -p manim ffmpeg manim-slides
```
+
or by adding it to your
[configuration file](https://nixos.org/manual/nixos/stable/#sec-package-management).
Alternatively, you can try Manim Slides in a Python environment with:
+
```sh
nix-shell -p manim ffmpeg "python3.withPackages(ps: with ps; [ manim-slides, ...])"
```
+
or bundle this into [your Nix environment](https://wiki.nixos.org/wiki/Python).
:::{note}
Nix current does not support `manimgl`.
:::
-
## When you need a Qt backend
Before `v5.1`, Manim Slides automatically included PySide6 as
@@ -182,5 +185,5 @@ install those are via optional dependencies, as explained above.
An alternative way to install Manim Slides is to clone the git repository,
and build the package from source. Read the
-[contributing guide](./contributing/workflow)
+[contributing guide](/contributing/workflow)
to know how to process.
diff --git a/docs/source/quickstart.md b/docs/source/quickstart.md
index 2cf8e35..c5b34b5 100644
--- a/docs/source/quickstart.md
+++ b/docs/source/quickstart.md
@@ -1,7 +1,7 @@
# Quickstart
If not already, install Manim Slides, along with either Manim or ManimGL,
-see [installation](./installation).
+see [installation](/installation).
## Creating your first slides
@@ -31,4 +31,5 @@ The output slides should look this this:
:quality: high
```
-For more advanced examples, see the [Examples](reference/examples) section.
+For more advanced examples,
+see the [Examples](/reference/examples) section.
diff --git a/docs/source/reference/gui.md b/docs/source/reference/gui.md
index 75ec189..29e7dcc 100644
--- a/docs/source/reference/gui.md
+++ b/docs/source/reference/gui.md
@@ -2,7 +2,8 @@
Manim Slides' graphical user interface (GUI) is the *de facto* way to present slides.
-If you do not specify one of the commands listed in the [CLI reference](./cli),
+If you do not specify one of the commands listed in the
+[CLI reference](/reference/cli),
Manim Slides will use **present** by default, which launches a GUI window,
playing your scene(s) like so:
@@ -25,7 +26,7 @@ directory, you should not worry about that :-)
## Configuration File
It is possible to configure Manim Slides via a configuration file, even though
-this feature is currently limited. You may initiliaze the default configuration
+this feature is currently limited. You may initialize the default configuration
file with:
```bash
diff --git a/docs/source/reference/html.md b/docs/source/reference/html.md
index 01c2186..24785c0 100644
--- a/docs/source/reference/html.md
+++ b/docs/source/reference/html.md
@@ -30,11 +30,11 @@ manim-slides convert --show-config
## Using a Custom Template
The default template used for HTML conversion can be found on
-[GitHub](https://github.com/jeertmans/manim-slides/blob/main/manim_slides/data/revealjs_template.html)
+[GitHub](https://github.com/jeertmans/manim-slides/blob/main/manim_slides/templates/revealjs.html)
or printed with the `--show-template` option.
If you wish to use another template, you can do so with the
`--use-template FILE` option.
## More about HTML Slides
-You can read more about HTML slides in the [sharing](./sharing) section.
+You can read more about HTML slides in the [sharing](/reference/sharing) section.
diff --git a/docs/source/reference/index.md b/docs/source/reference/index.md
index 7809bcd..0cf632f 100644
--- a/docs/source/reference/index.md
+++ b/docs/source/reference/index.md
@@ -16,23 +16,23 @@ sharing
Sphinx Extension
```
-[Application Programming Interface](./api): list of classes and methods that may
+[Application Programming Interface](/reference/api): list of classes and methods that may
be useful to the end-user.
-[Command Line Interface](./cli): list of all commands available using Manim
+[Command Line Interface](/reference/cli): list of all commands available using Manim
Slides' executable.
-[Examples](./examples): curated list of examples and their output.
+[Examples](/reference/examples): curated list of examples and their output.
-[Graphical User Interface](./gui): details about the main Manim Slide' feature.
+[Graphical User Interface](/reference/gui): details about the main Manim Slide' feature.
-[HTML Presentation](./html): an alternative way of presenting your animations.
+[HTML Presentation](/reference/html): an alternative way of presenting your animations.
-[IPython Magic](./ipython_magic): a magic to render and display Manim Slides inside notebooks.
+[IPython Magic](/reference/ipython_magic): a magic to render and display Manim Slides inside notebooks.
-+ [Example](./magic_example): example notebook using the magics.
++ [Example](/reference/magic_example): example notebook using the magics.
-[Sharing](./sharing): how to share your presentation with others.
+[Sharing](/reference/sharing): how to share your presentation with others.
-[Sphinx Extension](./sphinx_extension): a Sphinx extension for diplaying Manim Slides animations within your documentation.
+[Sphinx Extension](/reference/sphinx_extension): a Sphinx extension for displaying Manim Slides animations within your documentation.
diff --git a/docs/source/reference/sharing.md b/docs/source/reference/sharing.md
index 88c4e4a..16c6905 100644
--- a/docs/source/reference/sharing.md
+++ b/docs/source/reference/sharing.md
@@ -126,10 +126,15 @@ to use an `iframe`:
```
+
+
+
The additional code comes from
[this article](https://faq.dailymotion.com/hc/en-us/articles/360022841393-How-to-preserve-the-player-aspect-ratio-on-a-responsive-page)
and it there to preserve the original aspect ratio (16:9).
+
+
### Sharing ONE HTML file
If you set the `data_uri` option to `true` (with `-cdata_uri=true`),
@@ -142,8 +147,8 @@ HTML conversion makes it convenient to play your presentation on a
remote server.
This is how your are able to watch all the examples on this website. If you want
-to know how to share your slide with GitHub pages, see the
-[workflow file](https://github.com/jeertmans/manim-slides/blob/main/.github/workflows/pages.yml).
+to know how to share your slide with GitHub pages, check out the
+[Manim Slides Starter GitHub repository template](https://github.com/jeertmans/manim-slides-starter).
:::{warning}
Keep in mind that playing large video files over the internet network
diff --git a/manim_slides/config.py b/manim_slides/config.py
index f9b27f1..06c30ed 100644
--- a/manim_slides/config.py
+++ b/manim_slides/config.py
@@ -249,7 +249,11 @@ class PreSlideConfig(BaseSlideConfig):
if pre_slide_config.start_animation >= pre_slide_config.end_animation:
if pre_slide_config.start_animation == pre_slide_config.end_animation == 0:
raise ValueError(
- "You have to play at least one animation (e.g., `self.wait()`) before pausing. If you want to start paused, use the approriate command-line option when presenting. IMPORTANT: when using ManimGL, `self.wait()` is not considered to be an animation, so prefer to directly use `self.play(...)`."
+ "You have to play at least one animation (e.g., `self.wait()`) "
+ "before pausing. If you want to start paused, use the appropriate "
+ "command-line option when presenting. "
+ "IMPORTANT: when using ManimGL, `self.wait()` is not considered "
+ "to be an animation, so prefer to directly use `self.play(...)`."
)
raise ValueError(
diff --git a/manim_slides/convert.py b/manim_slides/convert.py
index b7a38d2..003c731 100644
--- a/manim_slides/convert.py
+++ b/manim_slides/convert.py
@@ -631,7 +631,7 @@ def show_template_option(function: Callable[..., Any]) -> Callable[..., Any]:
"--open",
"open_result",
is_flag=True,
- help="Open the newly created file using the approriate application.",
+ help="Open the newly created file using the appropriate application.",
)
@click.option("-f", "--force", is_flag=True, help="Overwrite any existing file.")
@click.option(
@@ -695,7 +695,7 @@ def convert(
errors = e.errors()
msg = [
- f"{len(errors)} error(s) occured with configuration options for '{to}', see below."
+ f"{len(errors)} error(s) occurred with configuration options for '{to}', see below."
]
for error in errors:
diff --git a/manim_slides/present/player.py b/manim_slides/present/player.py
index bba7dbc..cfcfbeb 100644
--- a/manim_slides/present/player.py
+++ b/manim_slides/present/player.py
@@ -56,7 +56,7 @@ class Info(QWidget): # type: ignore[misc]
self.video_sink = main_video_widget.videoSink()
left_layout.addWidget(main_video_widget)
- # Current slide informations
+ # Current slide information
self.scene_label = QLabel()
self.slide_label = QLabel()
diff --git a/manim_slides/templates/revealjs.html b/manim_slides/templates/revealjs.html
index 0c66468..ee4256e 100644
--- a/manim_slides/templates/revealjs.html
+++ b/manim_slides/templates/revealjs.html
@@ -262,7 +262,7 @@
mouseWheel: {{ mouse_wheel }},
// Opens links in an iframe preview overlay
- // Add `data-preview-link` and `data-preview-link="false"` to customise each link
+ // Add `data-preview-link` and `data-preview-link="false"` to customize each link
// individually
previewLinks: {{ preview_links }},
diff --git a/manim_slides/utils.py b/manim_slides/utils.py
index 4db34ee..2ea8c74 100644
--- a/manim_slides/utils.py
+++ b/manim_slides/utils.py
@@ -89,7 +89,7 @@ def link_nodes(*nodes: av.filter.context.FilterContext) -> None:
def reverse_video_file(src: Path, dest: Path) -> None:
- """Reverses a video file, writting the result to `dest`."""
+ """Reverses a video file, writing the result to `dest`."""
with av.open(str(src)) as input_container, av.open(
str(dest), mode="w"
) as output_container:
diff --git a/paper/paper.md b/paper/paper.md
index ea6966a..0891e94 100644
--- a/paper/paper.md
+++ b/paper/paper.md
@@ -66,7 +66,7 @@ provide new features on a regular basis.
# Easy to Use Commitment
-Manim Slides is commited to be an easy-to-use tool, with minimal installation
+Manim Slides is committed to be an easy-to-use tool, with minimal installation
procedure and few modifications required. It can either be used locally with its
graphical user interface (GUI), or shared via one of the two formats it can
convert to:
@@ -96,13 +96,13 @@ and posted it on YouTube.
# Stability and releases
-Manim Slides is continously tested on most recent Python versions, both ManimCE
+Manim Slides is continuously tested on most recent Python versions, both ManimCE
and ManimGL, and on all major platforms: **Ubuntu**, **macOS** and **Windows**. Due to Manim
Slide's exposed API being very minimal, and the variety of tests that are
performed, this tool can be considered stable over time.
New releases are very frequent, as they mostly introduce enhancements or small
-documention fixes, and the command-line tool automatically notifies for new
+documentation fixes, and the command-line tool automatically notifies for new
available updates. Therefore, regularly updating Manim Slides is highly
recommended.
@@ -160,7 +160,7 @@ For new feature requests, we highly encourage users to
[create an issue](https://github.com/jeertmans/manim-slides/issues/new/choose)
with the appropriate template.
-# Acknowledgements
+# Acknowledgments
We acknowledge the work of @manim-presentation that paved the initial structure
of Manim Slides with the manim-presentation Python package.
diff --git a/pyproject.toml b/pyproject.toml
index 8b9648c..755ea42 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -76,6 +76,12 @@ Founding = "https://github.com/sponsors/jeertmans"
Homepage = "https://github.com/jeertmans/manim-slides"
Repository = "https://github.com/jeertmans/manim-slides"
+[tool.codespell]
+builtin = "clear,rare,informal,usage,names,en-GB_to_en-US"
+check-hidden = true
+ignore-words-list = "master"
+skip = "pdm.lock"
+
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",