diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 74951d365f2..7d435683b1a 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -107,7 +107,7 @@ jobs: build make pip - myst-parser + myst-nb panel sphinx sphinx-autodoc-typehints diff --git a/ci/requirements/docs.yml b/ci/requirements/docs.yml index b7381844b92..605e5b750d5 100644 --- a/ci/requirements/docs.yml +++ b/ci/requirements/docs.yml @@ -22,7 +22,7 @@ dependencies: - make - pip # Dev dependencies (building documentation) - - myst-parser + - myst-nb - panel - sphinx - sphinx-autodoc-typehints diff --git a/doc/conf.py b/doc/conf.py index c32d22cd078..4fbdb8aacf9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -24,7 +24,7 @@ ) extensions = [ - "myst_parser", + "myst_nb", "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.coverage", @@ -153,7 +153,21 @@ # Sphinx project configuration templates_path = ["_templates"] -exclude_patterns = ["_build", "**.ipynb_checkpoints"] +exclude_patterns = [ + "_build", + "**.ipynb_checkpoints", + # Workaround from https://github.com/executablebooks/MyST-NB/issues/363 to prevent + # myst-nb from parsing the .ipynb and .py files generated by sphinx-gallery. + "gallery/**.ipynb", + "tutorials/**.ipynb", + "get_started/**.ipynb", + "projections/**.ipynb", + "gallery/**.py", + "tutorials/**.py", + "get_started/**.py", + "projections/**.py", +] + source_suffix = ".rst" needs_sphinx = "1.8" # The encoding of source files. diff --git a/doc/install.md b/doc/install.md index e6869fb8cd2..12cec95a62d 100644 --- a/doc/install.md +++ b/doc/install.md @@ -1,3 +1,7 @@ +--- +file_format: mystnb +--- + # Installing ## Quickstart @@ -233,16 +237,21 @@ from Python. To ensure that PyGMT and its dependencies are installed correctly, run the following in your Python interpreter: -```python +```{code-cell} ipython +--- +tags: [hide-output] +--- + import pygmt pygmt.show_versions() +``` +```{code-cell} ipython fig = pygmt.Figure() fig.coast(projection="N15c", region="g", frame=True, land="tan", water="lightblue") fig.text(position="MC", text="PyGMT", font="80p,Helvetica-Bold,red@75") fig.show() ``` -![pygmt-get-started](https://github.com/GenericMappingTools/pygmt/assets/3974108/f7f51484-8640-4b58-ae5b-6c71e7150f7a){.align-center width="70%"} You should see a global map with land and water masses colored in tan and lightblue respectively. On top, there should be the semi-transparent text "PyGMT". If the diff --git a/environment.yml b/environment.yml index 3e76f1e23c6..3d66bce5a5b 100644 --- a/environment.yml +++ b/environment.yml @@ -34,7 +34,7 @@ dependencies: - pytest-doctestplus - pytest-mpl # Dev dependencies (building documentation) - - myst-parser + - myst-nb - panel - sphinx - sphinx-autodoc-typehints