evennia/docs/README.md

215 lines
6.6 KiB
Markdown
Raw Normal View History

2020-04-05 00:02:02 +02:00
# evennia-docs
Documentation for the Evennia MUD creation system.
2020-04-10 11:19:39 +02:00
> WARNING: This system is still WIP and many things are bound to change!
2020-04-10 11:16:25 +02:00
> Contributing is still primarily to be done in the wiki.
2020-04-10 11:16:25 +02:00
The live documentation is (will in the future be) available at `https://evennia.github.io/evennia/`.
# Editing the docs
The docs source files are `*.md` files found in `evennia/docs/source/`. They
are simple text files that can be edited with a normal text editor and needs to
be decorated with [Markdown][commonmark] syntax.
Don't edit the files in `source/api/`. These are auto-generated and your changes
will be lost.
2020-04-10 11:01:35 +02:00
See also later in this doc for [Help with editing syntax](Help-with-editing-syntax).
2020-04-10 11:16:25 +02:00
## Contributing
2020-04-10 11:01:35 +02:00
Contributing to the docs is is like contributing to normal Evennia: Check out
the branch of Evennia you want to edit the documentation for. Then make your
own work-branch, make your changes and make a PR for it!
2020-04-05 00:02:02 +02:00
2020-04-05 15:02:38 +02:00
# Building the docs
2020-04-05 13:00:01 +02:00
The sources in `evennia/docs/source/` are built into a pretty documentation using
2020-04-10 11:01:35 +02:00
the [Sphinx][sphinx] static generator system. To do so locally you need to either
use a system with `make` (Linux/Unix/Mac) or run sphinx-commands manually.
2020-04-10 11:01:35 +02:00
You don't necessarily _have_ to build the docs locally to contribute. But
building them allows you to check for yourself that syntax is correct and that
your change comes out looking as you expected.
2020-04-05 13:00:01 +02:00
2020-04-10 11:01:35 +02:00
## Building only the main documentation
If you only want to build the main documentation pages (not the API autodocs),
you don't need to install Evennia itself, only the documentation resources.
All is done in your terminal/console.
2020-04-10 11:16:25 +02:00
- (Optional, but recommended): Activate a virtualenv with Python 3.7.
- `cd` to into the `evennia/docs` folder (where this README is).
- Install the documentation-build requirements:
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
make install
or
pip install -r requirements.txt
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
- Next we build the html-based documentation.
make quick
- The html-based documentation will appear in the new
folder `evennia/docs/build/html/`. Note any errors from files you have edited.
2020-04-10 11:01:35 +02:00
- Use a web browser to open `evennia/docs/builds/html/index.html` and view the docs.
Note that you will get errors if going to the auto-docs, because you didn't build them!
2020-04-10 11:01:35 +02:00
## Building the main documentation and API docs
The full documentation includes both the doc pages and the API documentation
generated from the Evennia source. For this you must install Evennia and
initialize a new game with a default database (you don't need to have it
running)
- Follow the normal [Evennia Getting-Started instructions][getting-started]
to install Evennia. Use a virtualenv.
2020-04-10 11:16:25 +02:00
- Make sure you `cd` to the folder _containing_ your `evennia/` repo (so two levels up from `docs/`).
- Create a new game folder called `gamedir` at the same level as your `evennia`
repo with
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
evennia --init gamedir
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
- Then `cd` into it and create a new, empty database. You don't need to start the game
or do any further changes.
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
evennia migrate
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
- This is how the structure should look at this point:
2020-04-05 13:00:01 +02:00
2020-04-10 11:19:39 +02:00
```
(top)
|
----- evennia/ (the top-level folder, containing docs/)
|
----- gamedir/
```
2020-04-05 13:00:01 +02:00
2020-04-10 11:01:35 +02:00
- Make sure you are still in your virtualenv, then go to `evennia/docs/` and
2020-04-10 11:16:25 +02:00
install the doc-building requirements:
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
make install
or
pip install -r requirements.txt
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
- Finally, build the full documentation, including the auto-docs:
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
make local
2020-04-10 11:19:39 +02:00
```
2020-04-10 11:16:25 +02:00
- The rendered files will appear in a new folder `evennia/docs/build/html`.
2020-04-10 11:01:35 +02:00
Note any errors from files you have edited.
- Point your web browser to `evennia/docs/build/html/index.html` to view the full docs.
2020-04-05 15:02:38 +02:00
## Building for release
2020-04-10 11:01:35 +02:00
The full Evennia documentation also tracks old versions of documentation based
on the available branches. The release-build will build all documentation
branches. Only specific official Evennia branches will be built so you can't
use this to build your own testing branch.
2020-04-05 15:02:38 +02:00
2020-04-10 11:01:35 +02:00
- All local changes must have been committed to git first, since the versioned
docs are built by looking at the git tree.
- To build for local checking, run (`mv` stands for "multi-version"):
2020-04-05 15:02:38 +02:00
2020-04-10 11:19:39 +02:00
```
2020-04-05 15:02:38 +02:00
make mv-local
2020-04-10 11:19:39 +02:00
```
2020-04-05 15:02:38 +02:00
- Once all is built and it looks ok, run
2020-04-10 11:19:39 +02:00
```
2020-04-05 15:02:38 +02:00
make deploy
2020-04-10 11:19:39 +02:00
```
2020-04-05 15:02:38 +02:00
Note that this step requires git-push access to the Evennia `gh-pages` branch on `github`.
If you know what you are doing you can also do
2020-04-10 11:19:39 +02:00
```
2020-04-05 15:02:38 +02:00
make release
2020-04-10 11:19:39 +02:00
```
2020-04-05 15:02:38 +02:00
2020-04-10 11:01:35 +02:00
This does the build + deploy steps in one go. After it finishes, the updated
live documentation will be available at `https://evennia.github.io/evennia/`.
2020-04-05 15:02:38 +02:00
# Help with editing syntax
## Referring to titles in another file
2020-04-10 11:01:35 +02:00
> WIP: Most of these special structures need more work and checking.
2020-04-05 15:02:38 +02:00
If file1 looks like this:
```
# Header title
```
2020-04-10 11:01:35 +02:00
2020-04-05 15:02:38 +02:00
You can refer to it from another file as
```
Read more about it [here](path.to.file1.md:Header title)
```
2020-04-10 11:01:35 +02:00
> This is not actually working at this time (WIP)
2020-04-05 15:02:38 +02:00
To refer to code in the Evennia repository, you can use a relative reference from the docs/ folder:
```
You can find this code [here](../evennia/objects/objects.py).
```
This will be automatically translated to the matching github link so the reader can click and jump to that code directly.
2020-04-10 11:01:35 +02:00
> This is not currently working. (WIP)
2020-04-05 15:02:38 +02:00
## Making indices
To make a document tree (what Sphinx refers to as a "Toc Tree"), make a list of document urls like this:
```
* [Title1](doc1.md)
* [Title2](doc2.md)
```
This will create a toc-tree structure behind the scenes.
We may expand on this later. For now, check out existing docs and refer to the
[Markdown][commonmark] (CommonMark) specification.
# Technical
Evennia leverages [Sphinx][sphinx] with the [recommonmark][recommonmark] extension, which allows us to write our
docs in light-weight Markdown (more specifically [CommonMark][commonmark], like on github) rather than ReST.
The recommonmark extension however also allows us to use ReST selectively in the places were it is more
expressive than the simpler (but much easier) Markdown.
For [autodoc-generation][sphinx-autodoc] generation, we use the sphinx-[napoleon][sphinx-napoleon] extension
to understand our friendly Google-style docstrings used in classes and functions etc.
[sphinx]: https://www.sphinx-doc.org/en/master/
[recommonmark]: https://recommonmark.readthedocs.io/en/latest/index.html
[commonmark]: https://spec.commonmark.org/current/
[sphinx-autodoc]: http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#module-sphinx.ext.autodoc
[sphinx-napoleon]: http://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
[getting-started]: https://github.com/evennia/evennia/wiki/Getting-Started