Skip to content

Commit 7f075ce

Browse files
author
Meghan Jones
authored
Fix header links and sphinx warnings (#1768)
1 parent c306352 commit 7f075ce

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

doc/api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Most calls to the C API happen through the :class:`pygmt.clib.Session` class.
258258

259259
clib.Session
260260

261-
`GMT modules <https://docs.generic-mapping-tools.org/latest/modules.html>`__ are executed through
261+
:gmt-docs:`GMT modules <modules.html>` are executed through
262262
the :meth:`~pygmt.clib.Session.call_module` method:
263263

264264
.. autosummary::

doc/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
# Autosummary pages will be generated by sphinx-autogen instead of sphinx-build
3535
autosummary_generate = []
3636

37+
# Auto-generate header anchors with MyST parser
38+
myst_heading_anchors = 4
39+
3740
# Make the list of returns arguments and attributes render the same as the
3841
# parameters list
3942
napoleon_use_rtype = False

doc/contributing.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ where you can submit general comments and/or questions:
9090
* For general comments, select *New Topic* from the
9191
[Lounge Page](https://forum.generic-mapping-tools.org/c/lounge/6).
9292
* To share your work, select *New Topic* from the
93-
[Showcase Page](https://forum.generic-mapping-tools.org/c/Sow-your-nice-example-script/10).
93+
[Showcase Page](https://forum.generic-mapping-tools.org/c/Show-your-nice-example-script/10).
9494

9595
## General Guidelines
9696

9797
### Resources for New Contributors
9898

9999
Please take a look at these resources to learn about Git and pull requests (don't
100-
hesitate to [ask questions](#getting-help)):
100+
hesitate to [ask questions](contributing.md#getting-help)):
101101

102102
* [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/).
103103
* [Git Workflow Tutorial](http://www.asmeurer.com/git-workflow/) by Aaron Meurer.
@@ -161,29 +161,30 @@ To increase the chances of getting your pull request accepted quickly, try to:
161161
- Write some documentation for your code (docstrings) and leave comments
162162
explaining the *reason* behind non-obvious things.
163163
- Write tests for the code you wrote/modified if needed.
164-
Please refer to [Testing your code](#testing-your-code) or
165-
[Testing plots](#testing-plots).
164+
Please refer to [Testing your code](contributing.md#testing-your-code) or
165+
[Testing plots](contributing.md#testing-plots).
166166
- Include an example of new features in the gallery or tutorials.
167-
Please refer to [Gallery plots](#gallery-plots) or [Tutorials](#tutorials).
167+
Please refer to [Gallery plots](contributing.md#contributing-gallery-plots)
168+
or [Tutorials](contributing.md#contributing-tutorials).
168169
* Have a good coding style
169170
- Use readable code, as it is better than clever code (even with comments).
170171
- Follow the [PEP8](http://pep8.org) style guide for code and the
171172
[NumPy style guide](https://numpydoc.readthedocs.io/en/latest/format.html)
172-
for docstrings. Please refer to [Code style](#code-style).
173+
for docstrings. Please refer to [Code style](contributing.md#code-style).
173174

174175
Pull requests will automatically have tests run by GitHub Actions.
175176
This includes running both the unit tests as well as code linters.
176177
GitHub will show the status of these checks on the pull request.
177178
Try to get them all passing (green).
178179
If you have any trouble, leave a comment in the PR or
179-
[get in touch](#how-can-i-talk-to-you).
180+
[get in touch](contributing.md#getting-help).
180181

181182
## Setting up your Environment
182183

183184
These steps for setting up your environment are necessary for
184-
[editing the documentation locally](#editing-the-documentation-locally) and
185-
[contributing code](#contributing-code). A local PyGMT development environment
186-
is not needed for [editing the documentation on GitHub](#editing-the-documentation-on-github).
185+
[editing the documentation locally](contributing.md#editing-the-documentation-locally) and
186+
[contributing code](contributing.md#contributing-code). A local PyGMT development environment
187+
is not needed for [editing the documentation on GitHub](contributing.md#editing-the-documentation-on-github).
187188

188189
We highly recommend using [Anaconda](https://www.anaconda.com/download/) and the `conda`
189190
package manager to install and manage your Python packages.
@@ -244,24 +245,24 @@ There are four main components to PyGMT's documentation:
244245
The documentation are written primarily in
245246
[reStructuredText](https://docutils.sourceforge.io/rst.html) and built by
246247
[Sphinx](http://www.sphinx-doc.org/). Please refer to
247-
[reStructuredText Cheatsheet](https://docs.generic-mapping-tools.org/latest/devdocs/rst-cheatsheet.html)
248+
{gmt-docs}`reStructuredText Cheatsheet <devdocs/rst-cheatsheet.html>`
248249
if you are new to reStructuredText. When contributing documentation, be sure to
249-
follow the general guidelines in the [pull request workflow](#pull-request-workflow)
250+
follow the general guidelines in the [pull request workflow](contributing.md#pull-request-workflow)
250251
section.
251252

252253
There are two primary ways to edit the PyGMT documentation:
253254
- For simple documentation changes, you can easily
254-
[edit the documentation on GitHub](#editing-the-documentation-on-github).
255+
[edit the documentation on GitHub](contributing.md#editing-the-documentation-on-github).
255256
This only requires you to have a GitHub account.
256257
- For more complicated changes, you can
257-
[edit the documentation locally](#editing-the-documentation-locally).
258+
[edit the documentation locally](contributing.md#editing-the-documentation-locally).
258259
In order to build the documentation locally, you first need to
259-
[set up your environment](#setting-up-your-environment).
260+
[set up your environment](contributing.md#setting-up-your-environment).
260261

261262
### Editing the Documentation on GitHub
262263

263264
If you're browsing the documentation and notice a typo or something that could be
264-
improved, please consider letting us know by [creating an issue](#reporting-a-bug) or
265+
improved, please consider letting us know by [creating an issue](contributing.md#reporting-a-bug) or
265266
(even better) submitting a fix.
266267

267268
You can submit fixes to the documentation pages completely online without having to
@@ -288,14 +289,14 @@ download and install anything:
288289
9. Done!
289290

290291
Alternatively, you can make the changes offline to the files in the `doc` folder or the
291-
example scripts. See [editing the documentation locally](#editing-the-documentation-locally)
292+
example scripts. See [editing the documentation locally](contributing.md#editing-the-documentation-locally)
292293
for instructions.
293294

294295
### Editing the Documentation Locally
295296

296297
For more extensive changes, you can edit the documentation in your cloned repository
297298
and build the documentation to preview changes before submitting a pull request. First,
298-
follow the [setting up your environment](#setting-up-your-environment) instructions.
299+
follow the [setting up your environment](contributing.md#setting-up-your-environment) instructions.
299300
After making your changes, you can build the HTML files from sources using:
300301

301302
```bash
@@ -305,15 +306,15 @@ make all
305306

306307
This will build the HTML files in `doc/_build/html`.
307308
Open `doc/_build/html/index.html` in your browser to view the pages. Follow the
308-
[pull request workflow](#pull-request-workflow) to submit your changes for review.
309+
[pull request workflow](contributing.md#pull-request-workflow) to submit your changes for review.
309310

310311
### Contributing Gallery Plots
311312

312313
The gallery and tutorials are managed by
313314
[sphinx-gallery](https://sphinx-gallery.readthedocs.io/).
314315
The source files for the example gallery are `.py` scripts in `examples/gallery/` that
315316
generate one or more figures. They are executed automatically by sphinx-gallery when
316-
the [documentation is built](#building-the-documentation). The output is gathered and
317+
the [documentation is built](contributing.md#editing-the-documentation-locally). The output is gathered and
317318
assembled into the gallery.
318319

319320
You can **add a new** plot by placing a new `.py` file in one of the folders inside the
@@ -421,11 +422,10 @@ Linking to the GMT documentation and GMT configuration parameters can be done us
421422
- <code>:gmt-term:\`GMT_PARAMETER\`</code>
422423

423424
An example would be using
424-
<code>:gmt-docs:\`makecpt.html\`</code> to link to
425-
[https://docs.generic-mapping-tools.org/latest/makecpt.html](https://docs.generic-mapping-tools.org/latest/makecpt.html).
425+
<code>:gmt-docs:\`makecpt.html\`</code> to link to {gmt-docs}`makecpt.html`.
426426
For GMT configuration parameters, an example is
427427
<code>:gmt-term:\`COLOR_FOREGROUND\`</code> to link to
428-
[https://docs.generic-mapping-tools.org/latest/gmt.conf.html#term-COLOR_FOREGROUND](https://docs.generic-mapping-tools.org/latest/gmt.conf.html#term-COLOR_FOREGROUND).
428+
{gmt-term}`https://docs.generic-mapping-tools.org/latest/gmt.conf#term-COLOR_FOREGROUND <COLOR_FOREGROUND>`.
429429

430430
Sphinx will create a link to the automatically generated page for that
431431
function/class/module.
@@ -436,7 +436,7 @@ function/class/module.
436436

437437
The source code for PyGMT is located in the `pygmt/` directory. When contributing
438438
code, be sure to follow the general guidelines in the
439-
[pull request workflow](#pull-request-workflow) section.
439+
[pull request workflow](contributing.md#pull-request-workflow) section.
440440

441441
### Code Style
442442

doc/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ latest released version that can be found at
5353
the `GMT official site <https://www.generic-mapping-tools.org>`__.
5454
We need the latest GMT (>=6.3.0) since there are many changes being made to GMT
5555
itself in response to the development of PyGMT, mainly the new
56-
`modern execution mode <https://docs.generic-mapping-tools.org/latest/cookbook/introduction.html#modern-and-classic-mode>`__.
56+
:gmt-docs:`modern execution mode <cookbook/introduction.html#modern-and-classic-mode>`.
5757

5858
Compiled conda packages of GMT for Linux, macOS and Windows are provided
5959
through `conda-forge <https://anaconda.org/conda-forge/gmt>`__.

0 commit comments

Comments
 (0)