Skip to content

Commit

Permalink
📚 DOCS: Fix typos and add codespell pre-commit hook (#475)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Holdgraf <choldgraf@berkeley.edu>
  • Loading branch information
kianmeng and choldgraf authored Aug 23, 2023
1 parent aae27bb commit 35ebd54
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
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 @@ -276,7 +276,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 @@ -640,7 +640,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 @@ -791,7 +791,7 @@ def _render_markdown_base(
self, data: MimeData, *, fmt: str, inline: 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 @@ -819,7 +819,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 @@ -830,7 +830,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 @@ -364,7 +364,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

0 comments on commit 35ebd54

Please sign in to comment.