Skip to content

Commit a3e9b2c

Browse files
committed
Fix: massive update to the structure of the docs section
1 parent 34ced3b commit a3e9b2c

18 files changed

+298
-208
lines changed

ci-and-testing/intro.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
# CI and Testing
1+
# CI and Testing - Coming Soon!
2+
3+
4+
This section is evolving and should be published by the end of Spring 2023
5+
26

37
coming soon

documentation/hosting-tools/intro.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# Tools to Build and Host your Documentation
22

3-
The mmostsot common tool for building documentation in the Python
4-
ecosystem is Sphinx. However, some are using tools like
5-
mkdocs for documentation. In the end it is up to you to
3+
The most common tool for building documentation in the Python
4+
ecosystem currently is Sphinx. However, some maintainers
5+
are using tools like [mkdocs](https://www.mkdocs.org/) for documentation. It is up to you to
66
use the platform that you prefer for your documentation!
77

8-
In this section, we introduce sphinx as a common tool to
8+
In this section, we introduce Sphinx as a common tool to
99
build documentation. We also talk about ways to publish your
1010
documentation online and Sphinx tools that might help you optimize
1111
your documentation website.
1212

1313
```{toctree}
1414
:maxdepth: 2
1515
16-
Sphinx Tools <python-package-documentation-tools.md>
16+
Sphinx for Docs <sphinx-python-package-documentation-tools.md>
17+
myST vs Markdown vs rst <myst-markdown-rst-doc-syntax.md>
1718
Publish Your Docs <publish-documentation-online.md>
1819
Website Hosting and Optimization <website-hosting-optimizing-your-docs.md>
1920
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Documentation syntax: markdown vs. myST vs. rst syntax to create your docs
2+
3+
There are three commonly used syntaxes for creating Python documentation:
4+
1. [markdown](https://www.markdownguide.org/): Markdown is an easy-to-learn text
5+
syntax. It is the default syntax use in Jupyter Notebooks. There are tools that you can add to a sphinx website that allow it to render markdown as html. However, using markdown to write documentation has limitations. For instance if you want to add references,
6+
colored call out blocks and other custom elements to your documentation, you will
7+
need to use either **myST** or **rST**.
8+
1. [rST (ReStructured Text):](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html). **rST** is the native syntax that sphinx supports. rST was the default syntax used for documentation for many years given the limitations of markdown. However, in recent years myST has risen to the top as a favorite for documentation given the flexibility that it allows.
9+
1. [myST:](https://myst-parser.readthedocs.io/en/latest/intro.html) myST is a combination of vanilla of `markdown` and `rST` syntax. It is a nice option if you are comfortable writing markdown. `myst` is preferred by many because it offers both the rich functionality
10+
of rST combined with a simple-to-write markdown syntax.
11+
12+
While you can chose to use any of the syntaxes listed above, we suggest using
13+
`myST` because:
14+
15+
* It is a simpler syntax and thus easier to learn;
16+
* The above simplicity will make it easier for more people to contribute to your documentation.
17+
* Most of your core python package text files, such as your README.md file, are already in `.md` format
18+
* `GitHub` and `Jupyter Notebooks` support markdown thus it's more widely used in the scientific ecosystem.
19+
20+
21+
```{tip}
22+
If you are on the fence about myST vs rst, you might find that **myST** is easier
23+
for more people to contribute to.
24+
```
25+
26+
<!-- TODO
27+
- add some text examples of using rst vs md vs myst?
28+
- Better explain what rst / myst offer that markdown can't do
29+
-->

documentation/hosting-tools/python-package-documentation-tools.md

Lines changed: 0 additions & 109 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Using Sphinx to Build Python Package Documentation
2+
3+
<!-- TODO: make this into include files so we can have a summary
4+
important points page -->
5+
<!--
6+
```{important}
7+
8+
## Take Aways: Key Python Package Tools to Use
9+
10+
* Use Sphinx to build your documentation
11+
* Publish your documentation on ReadTheDocs (or GitHub pages if you are more advanced and also prefer to maintain your website locally)
12+
* Use `myST` syntax to write your documentation
13+
* Use sphinx gallery to write tutorials using .py files that automagically have downloadable .py and jupyter notebook files. Use nbsphinx if you prefer writing tutorials in jupyter notebook format and don't need a grid formatted gallery. *Both of these tools will run your tutorials from beginning to end providing an addition layer of testing to your package!*
14+
* OPTIONAL: Use [doctest](https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html) to run the examples in your code's docstrings as a way to make sure that your code's functions and methods (the API) are running as you expect them to.
15+
``` -->
16+
17+
On this page we discuss using [Sphinx](https://www.sphinx-doc.org/) to build your user-facing
18+
package documentation. While Sphinx is currently the most
19+
commonly-used tool in the scientific Python ecosystem, you
20+
are welcome to explore other tools to build documentation
21+
such as [mkdocs](https://www.mkdocs.org/) which is gaining
22+
popularity in the Python packaging ecosystem.
23+
24+
```{tip}
25+
Examples of documentation websites that we love:
26+
27+
* [GeoPandas](https://geopandas.org/en/stable/)
28+
* [View rst to create landing page](https://raw.githubusercontent.com/geopandas/geopandas/main/doc/source/index.rst)
29+
* [verde](https://www.fatiando.org/verde/latest/)
30+
* [View verde landing page code - rst file.](https://github.com/fatiando/verde/blob/main/doc/index.rst)
31+
* [Here is our documentation if you want to see a myST example of a landing page.](https://github.com/pyOpenSci/python-package-guide/blob/main/index.md)
32+
```
33+
34+
## Sphinx - a static site generator
35+
36+
Sphinx is a [static-site generator](https://www.cloudflare.com/learning/performance/static-site-generator/). A static site generator is a tool that creates
37+
html for a website based upon a set of templates. The html files are then served "Statically" which means that there is no generation or modification of the files on the fly.
38+
39+
Sphinx is written using Python.
40+
41+
### Sphinx sites can be customized using extensions and themes
42+
43+
The functionality of Sphinx can be extended using extensions
44+
and themes. A few examples include:
45+
46+
* You can apply documentation themes for quick generation of beautiful documentation.
47+
* You can [automatically create documentation for your package's functions and classes (that package's API) from docstrings in your code using the autodoc extension](https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html)
48+
* You can [run and test code examples in your docstrings using the doctest extension](https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html)
49+
* While sphinx natively supports the `rST` syntax. You can add custom syntax parsers to support easier-to-write syntax using tools such as [myst](https://myst-parser.readthedocs.io/).
50+
51+
### Commonly used sphinx themes
52+
53+
You are free to use whatever sphinx theme that you prefer.
54+
However, the most common sphinx themes used in the Python
55+
scientific community include:
56+
57+
* [pydata-sphinx-theme](https://pydata-sphinx-theme.readthedocs.io/)
58+
* [sphinx-book-theme](https://sphinx-book-theme.readthedocs.io/)
59+
* [furo](https://pradyunsg.me/furo/quickstart/)
60+
61+
62+
```{tip}
63+
This book is created using Sphinx and the `furo` theme.
64+
```
65+
<!-- Should this also be it's own page?-->
66+
67+

documentation/hosting-tools/website-hosting-optimizing-your-docs.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,32 @@ add some core sphinx extensions (and theme settings) that will help search
55
engines such as Google find your documentation.
66

77
### Google Analytics
8+
9+
```{important}
10+
Google analytics [is not compliant with the European General Data Protection Regulation (GDPR)](https://matomo.org/blog/2022/05/google-analytics-4-gdpr/). While there are many components to this regulation, one of the core elements is that you have to let users know on your site that you are collecting data and they have to consent. WHile it is possible to add infrastructure around Google Analytics to make it close to following GDPR regulations, the community is slowly shifting away from Google using open tools such as [Plausible](https://plausible.io/), [Cloudflare Web Analytics](https://www.cloudflare.com/web-analytics/) and [Matomo](https://matomo.org) for web analytics.
11+
12+
pyOpenSci is currently looking into free options for open source
13+
developers.
14+
```
815
Some of the [sphinx themes such as the `pydata-sphinx-theme` and
9-
sphinx-book-theme have built in support for google analytics](https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/analytics.html#google-analytics). However, if the theme that you chose does not offer
16+
sphinx-book-theme have built in support for Google Analytics](https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/analytics.html#google-analytics). However, if the theme that you chose does not offer
1017
Google Analytics support, you can use the [`sphinxcontrib-gtagjs` extension](https://github.com/attakei/sphinxcontrib-gtagjs).
1118
This extension will add a Google Analytics site tag to each page of your
1219
documentation.
1320

14-
### [sphinx-sitemap](https://sphinx-sitemap.readthedocs.io/en/latest/index.html)
21+
### [sphinx-sitemap](https://sphinx-sitemap.readthedocs.io/en/latest/index.html) for search engine optimization
22+
23+
While we are trying to move away from Google Analytics do
24+
to compliance and privacy issues, search engine optimization
25+
is still important. Google is the most popular search engine.
26+
And if your documentation is search optimized, users are more
27+
likely to find your package!
1528

16-
If you are interested in optimizing your documentation for search engines such as Google, you want a sitemap.xml file. You can submit this sitemap to Google and it will index your entire site. This over time can make the content on your site more visible to others when they search.
29+
If you are interested in optimizing your documentation for
30+
search engines such as Google, you want a **sitemap.xml** file.
31+
You can submit this sitemap to Google and it will index your
32+
entire site. This over time can make the content on your site
33+
more visible to others when they search.
1734

1835
This extension is lightweight.
1936

@@ -24,4 +41,6 @@ It [requires that you to add it to your sphinx `conf.py` extension list and site
2441
OpenGraph is an extension that allows you to add metadata to your documentation
2542
content pages. [The OpenGraph protocol allows other websites to provide a
2643
useful preview of the content on your page when shared](https://www.freecodecamp.org/news/what-is-open-graph-and-how-can-i-use-it-for-my-website/#what-is-open-graph). This is important
27-
for when the pages in your documentation are shared.
44+
for when the pages in your documentation are shared on social
45+
media sites like Twitter and Mastodon and even for shares on
46+
tools like Slack and Discourse.

0 commit comments

Comments
 (0)