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: Fix typos and add codespell pre-commit hook #475

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ repos:
(?x)^(
myst_nb/.+\.py|
)$

- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
args: ["-S", "*.ipynb"]
2 changes: 1 addition & 1 deletion docs/reference/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Optionally you can run `black` and `flake8` separately:

Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard.

All functions and class methods should be annotated with types and include a docstring. The prefered docstring format is outlined in `MyST-NB/docstring.fmt.mustache` and can be used automatically with the
All functions and class methods should be annotated with types and include a docstring. The preferred docstring format is outlined in `MyST-NB/docstring.fmt.mustache` and can be used automatically with the
[autodocstring](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring) VS Code extension.

## Testing
Expand Down
4 changes: 2 additions & 2 deletions docs/render/glue.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Below we'll calculate a few statistics of interest, and `glue()` them into the n
```{code-cell} ipython3
# Calculate the mean of a bunch of random samples
means = data[bootstrap_indices].mean(0)
# Calcualte the 95% confidence interval for the mean
# Calculate the 95% confidence interval for the mean
clo, chi = np.percentile(means, [2.5, 97.5])

# Store the values in our notebook
Expand All @@ -91,7 +91,7 @@ glue("boot_chi_notdisplayed", chi, display=False)
You can also glue visualizations, such as matplotlib figures (here we use `display=False` to ensure that the figure isn't plotted twice):

```{code-cell} ipython3
# Visualize the historgram with the intervals
# Visualize the histogram with the intervals
fig, ax = plt.subplots()
ax.hist(means)
for ln in [clo, chi]:
Expand Down
10 changes: 5 additions & 5 deletions myst_nb/core/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def _render_nb_cell_code_outputs(

# TODO how to output MyST Markdown?
# currently text/markdown is set to be rendered as CommonMark only,
# with headings dissallowed,
# with headings disallowed,
# to avoid "side effects" if the mime is discarded but contained
# targets, etc, and because we can't parse headings within containers.
# perhaps we could have a config option to allow this?
Expand Down Expand Up @@ -646,7 +646,7 @@ def render_image(self, data: MimeData) -> list[nodes.Element]:
# data is b64-encoded as text
data_bytes = a2b_base64(data.content)
elif isinstance(data.content, str):
# ensure corrent line separator
# ensure correct line separator
data_bytes = os.linesep.join(data.content.splitlines()).encode("utf-8")
# create filename
extension = (
Expand Down Expand Up @@ -799,7 +799,7 @@ def _render_markdown_base(
self, data: MimeData, *, fmt: str, inline: bool, allow_headings: bool
) -> list[nodes.Element]:
"""Base render for a notebook markdown mime output (block or inline)."""
psuedo_element = nodes.Element() # element to hold the parsed markdown
pseudo_element = nodes.Element() # element to hold the parsed markdown
current_parser = self.renderer.md
current_md_config = self.renderer.md_config
try:
Expand Down Expand Up @@ -827,7 +827,7 @@ def _render_markdown_base(
)
return []

with self.renderer.current_node_context(psuedo_element):
with self.renderer.current_node_context(pseudo_element):
self.renderer.nested_render_text(
data.string,
data.line or 0,
Expand All @@ -839,7 +839,7 @@ def _render_markdown_base(
self.renderer.md = current_parser
self.renderer.md_config = current_md_config

return psuedo_element.children
return pseudo_element.children


class EntryPointError(Exception):
Expand Down
2 changes: 1 addition & 1 deletion myst_nb/sphinx_.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def run(self, **kwargs: Any) -> None:


class NbMetadataCollector(EnvironmentCollector):
"""Collect myst-nb specific metdata, and handle merging of parallel builds."""
"""Collect myst-nb specific metadata, and handle merging of parallel builds."""

@staticmethod
def set_doc_data(env: SphinxEnvType, docname: str, key: str, value: Any) -> None:
Expand Down