|
1 |
| -# example-mkdocs-basic |
2 |
| -A basic MkDocs project for Read the Docs |
| 1 | +Example: Basic MkDocs project for Read the Docs |
| 2 | +=============================================== |
| 3 | + |
| 4 | +[](https://example-mkdocs-basic.readthedocs.io/en/latest/?badge=latest) |
| 5 | + |
| 6 | +This example shows the an integration of a basic MkDocs project with Read the Docs. You\'re encouraged to view it to get inspiration and copy & paste from the files in the source code. If you are using Read the Docs for the first time, have a look at the official [Read the Docs Tutorial](https://docs.readthedocs.io/en/stable/tutorial/index.html). |
| 7 | + |
| 8 | +📚 [docs/](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/docs/)<br> |
| 9 | +A basic MkDocs project lives in `docs/`, it was generated using MkDocs defaults. All the `*.md` make up sections in the documentation. |
| 10 | + |
| 11 | +⚙️ [.readthedocs.yaml](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/.readthedocs.yaml)<br> |
| 12 | +Read the Docs Build configuration is stored in `.readthedocs.yaml`. |
| 13 | + |
| 14 | +⚙️ [mkdocs.yml](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/mkdocs.yaml)<br> |
| 15 | +A basic [MkDocs configuration](https://www.mkdocs.org/user-guide/configuration/) is stored here, including a few extensions for MkDocs and Markdown. Add your own configurations here, such as extensions and themes. Remember that many extensions and themes require additional Python packages to be installed. |
| 16 | + |
| 17 | +📍 [docs/requirements.txt](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/docs/requirements.txt) and [docs/requirements.in](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/docs/requirements.in)<br> |
| 18 | +Python dependencies are [pinned](https://docs.readthedocs.io/en/latest/guides/reproducible-builds.html) (uses [pip-tools](https://pip-tools.readthedocs.io/en/latest/)) here. Make sure to add your Python dependencies to `requirements.txt` or if you choose [pip-tools](https://pip-tools.readthedocs.io/en/latest/), edit `docs/requirements.in` and remember to run to run `pip-compile docs/requirements.in`. |
| 19 | + |
| 20 | +💡 [docs/api.md](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/docs/api.md)<br> |
| 21 | +We add our example Python module `lumache` in order to auto-generate an API reference. To do this, we use the `:::` syntax, you can read more in the [mkdocstrings documentation](https://mkdocstrings.github.io/). |
| 22 | + |
| 23 | +💡 [docs/usage.md](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/docs/usage.md)<br> |
| 24 | +We also include some direct links to a function from the API reference, as well as embedding documentation for the example function `lumache.get_random_recipe`. This functionality is also from the [mkdocstrings](https://mkdocstrings.github.io/python/) extension. |
| 25 | + |
| 26 | +💡 [lumache.py](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/lumache.py)<br> |
| 27 | +API docs are generated for this example Python module - they use *docstrings* directly in the documentation, notice how this shows up in the rendered documentation. We use the [Sphinx convention](https://pythonhosted.org/an_example_pypi_project/sphinx.html#function-definitions) for docstrings, however you are free to edit `mkdocs.yml` to change this option to `google` or `numpy`. |
| 28 | + |
| 29 | +🔢 Git tags versioning<br> |
| 30 | +We use a basic versioning mechanism by adding a git tag for every release of the example project. All releases and their version numbers are visible on |
| 31 | +[example-mkdocs-basic.readthedocs.io](https://example-mkdocs-basic.readthedocs.io/en/latest/). |
| 32 | + |
| 33 | +📜 [README.rst](https://github.com/readthedocs-examples/example-mkdocs-basic/blob/main/README.rst)<br> |
| 34 | +Contents of this `README.md` are visible on Github and included on [the documentation index page](https://example-mkdocs-basic.readthedocs.io/en/latest/) (Don\'t Repeat Yourself). |
| 35 | + |
| 36 | +⁉️ Questions / comments<br> |
| 37 | +If you have questions related to this example, feel free to can ask them as a Github issue [here](https://github.com/readthedocs-examples/example-mkdocs-basic/issues). |
| 38 | + |
| 39 | + |
| 40 | +Example Project usage |
| 41 | +--------------------- |
| 42 | + |
| 43 | +This project has a standard MkDocs layout which is built by Read the Docs almost the same way that you would build it locally (on your own laptop!). |
| 44 | + |
| 45 | +You can build and view this documentation project locally - we recommend that you activate [a local Python virtual environment first](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment): |
| 46 | + |
| 47 | +```console |
| 48 | +# Install required Python dependencies (MkDocs etc.) |
| 49 | +pip install -r docs/requirements.txt |
| 50 | + |
| 51 | +# Run the mkdocs development server |
| 52 | +mkdocs serve |
| 53 | +``` |
| 54 | + |
| 55 | +Using the example in your own project |
| 56 | +------------------------------------- |
| 57 | + |
| 58 | +If you are new to Read the Docs, you may want to refer to the [Read the Docs User documentation](https://docs.readthedocs.io/). |
| 59 | + |
| 60 | +If you are copying this code in order to get started with your documentation, you need to: |
| 61 | + |
| 62 | +1. place your `docs/` folder alongside your Python project. If you are starting a new project, you can adapt the `pyproject.toml` example configuration. |
| 63 | +1. use your existing project repository or create a new repository on Github, GitLab, Bitbucket or another host supported by Read the Docs. |
| 64 | +1. copy in `mkdocs.yaml`, `.readthedocs.yml` and the `docs/` folder into your project. Customize all the files, replacing example contents. |
| 65 | +1. Rebuild the documenation locally to see that it works. |
| 66 | +1. *Finally*, register your project on Read the Docs, see [Importing Your Documentation](https://docs.readthedocs.io/en/stable/intro/import-guide.html). |
| 67 | + |
| 68 | + |
| 69 | +Read the Docs tutorial |
| 70 | +---------------------- |
| 71 | + |
| 72 | +To get started with Read the Docs, you may also refer to the [Read the Docs tutorial](https://docs.readthedocs.io/en/stable/tutorial/). It provides a full walk-through of building an example project similar to the one in this repository. |
0 commit comments