You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/contributor/documentation.md
+46-38Lines changed: 46 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,76 +50,78 @@ If you would like to read more about the Dataverse's use of GitHub, please see t
50
50
51
51
## Building the Guides with Sphinx
52
52
53
-
While the "quick fix" technique shown above should work fine for minor changes, especially for larger changes, we recommend installing Sphinx on your computer or using a Sphinx Docker container to build the guides locally so you can get an accurate preview of your changes.
53
+
While the "quick fix" technique shown above should work fine for minor changes, in many cases, you're going to want to preview changes locally before committing them.
54
54
55
-
In case you decide to use a Sphinx Docker container to build the guides, you can skip the next two installation sections, but you will need to have Docker installed.
55
+
Before we worry about pushing changes to the code, let's make sure we can build the guides.
56
56
57
-
### Installing Sphinx
57
+
Go to <https://github.com/IQSS/dataverse> and click "Code" and then follow the instructions to clone the code locally.
58
58
59
-
First, make a fork of <https://github.com/IQSS/dataverse> and clone your fork locally. Then change to the ``doc/sphinx-guides`` directory.
Create a Python virtual environment, activate it, then install dependencies:
63
+
From a terminal, switch to the "dataverse" directory you just cloned. This is the root of the git repo.
64
64
65
-
``python3 -m venv venv``
65
+
`cd dataverse`
66
66
67
-
``source venv/bin/activate``
67
+
Then try running this command:
68
68
69
-
``pip install -r requirements.txt``
69
+
`docker run -it --rm -v $(pwd):/docs sphinxdoc/sphinx:7.2.6 bash -c "cd doc/sphinx-guides && pip3 install -r requirements.txt && make html"`
70
70
71
-
### Installing GraphViz
71
+
If all goes well, you should be able to open `doc/sphinx-guides/build/html/index.html` to see the guides you just built.
72
72
73
-
In some parts of the documentation, graphs are rendered as images using the Sphinx GraphViz extension.
73
+
#### Docker with a Makefile
74
74
75
-
Building the guides requires the ``dot`` executable from GraphViz.
75
+
Once you've confirmed you have Docker working, if you have [make](https://en.wikipedia.org/wiki/Make_(software)) installed, you can try the following commands:
76
76
77
-
This requires having [GraphViz](https://graphviz.org) installed and either having ``dot`` on the path or
78
-
[adding options to the `make` call](https://groups.google.com/forum/#!topic/sphinx-users/yXgNey_0M3I).
77
+
`make docs-html`
79
78
80
-
On a Mac we recommend installing GraphViz through [Homebrew](<https://brew.sh>). Once you have Homebrew installed and configured to work with your shell, you can type `brew install graphviz`.
79
+
`make docs-pdf`
81
80
82
-
### Editing and Building the Guides
81
+
`make docs-epub`
83
82
84
-
To edit the existing documentation:
83
+
`make docs-all`
85
84
86
-
- Create a branch (see {ref}`how-to-make-a-pull-request`).
87
-
- In ``doc/sphinx-guides/source`` you will find the .rst files that correspond to https://guides.dataverse.org.
88
-
- Using your preferred text editor, open and edit the necessary files, or create new ones.
85
+
### Sphinx Installed Locally
89
86
90
-
Once you are done, you can preview the changes by building the guides locally. As explained, you can build the guides with Sphinx locally installed, or with a Docker container.
87
+
First, run `python --version` or `python3 --version` to determine the version of Python you have. If you don't have Python 3.10 or higher, you must upgrade.
91
88
92
-
#### Building the Guides with Sphinx Installed Locally
93
-
94
-
Open a terminal, change directories to `doc/sphinx-guides`, activate (or reactivate) your Python virtual environment, and build the guides.
89
+
Next, change to the `doc/sphinx-guides` directory.
95
90
96
91
`cd doc/sphinx-guides`
97
92
93
+
Create a Python virtual environment, activate it, then install dependencies:
94
+
95
+
`python3 -m venv venv`
96
+
98
97
`source venv/bin/activate`
99
98
100
-
`make clean`
99
+
`pip install -r requirements.txt`
101
100
102
-
`make html`
101
+
Next, install [GraphViz](https://graphviz.org) because building the guides requires having the `dot` executable from GraphViz either on the path or passed [as an argument](https://groups.google.com/g/sphinx-users/c/yXgNey_0M3I/m/3T2NipFlBgAJ).
103
102
104
-
#### Building the Guides with a Sphinx Docker Container and a Makefile
103
+
On a Mac we recommend installing GraphViz through [Homebrew](<https://brew.sh>). Once you have Homebrew installed and configured to work with your shell, you can type `brew install graphviz`.
105
104
106
-
We have added a Makefile to simplify the process of building the guides using a Docker container, you can use the following commands from the repository root:
105
+
Finally, you can try building the guides with the following command.
107
106
108
-
-`make docs-html`
109
-
-`make docs-pdf`
110
-
-`make docs-epub`
111
-
-`make docs-all`
107
+
`make html`
112
108
113
-
#### Building the Guides with a Sphinx Docker Container and CLI
109
+
If all goes well, you should be able to open `doc/sphinx-guides/build/html/index.html` to see the guides you just built.
114
110
115
-
If you want to build the guides using a Docker container, execute the following command in the repository root:
111
+
## Editing, Building, and Previewing the Guides
116
112
117
-
`docker run -it --rm -v $(pwd):/docs sphinxdoc/sphinx:7.2.6 bash -c "cd doc/sphinx-guides && pip3 install -r requirements.txt && make html"`
113
+
To edit the existing documentation:
118
114
119
-
#### Previewing the Guides
115
+
- Create a branch (see {ref}`how-to-make-a-pull-request`).
116
+
- In `doc/sphinx-guides/source` you will find the .rst or .md files that correspond to https://guides.dataverse.org.
117
+
- Using your preferred text editor, open and edit the necessary files, or create new ones.
118
+
119
+
Once you are done, you can preview the changes by building the guides using one of the options above.
120
120
121
121
After Sphinx is done processing the files you should notice that the `html` folder in `doc/sphinx-guides/build` directory has been updated. You can click on the files in the `html` folder to preview the changes.
122
122
123
+
## Making a Pull Request
124
+
123
125
Now you can make a commit with the changes to your own fork in GitHub and submit a pull request. See {ref}`how-to-make-a-pull-request`.
124
126
125
127
## Writing Guidelines
@@ -153,16 +155,22 @@ If the page is written in Markdown (.md), use this form:
153
155
154
156
### Links
155
157
156
-
Getting links right with .rst files can be tricky.
158
+
Getting links right can be tricky.
157
159
158
160
#### Custom Titles
159
161
160
-
You can use a custom title when linking to a document like this:
162
+
In .rst files you can use a custom title when linking to a document like this:
161
163
162
164
:doc:`Custom title </api/intro>`
163
165
164
166
See also <https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html#the-doc-role>
165
167
168
+
In .md files, the same pattern can be used. Here's an example of using a custom title with a ref:
169
+
170
+
{ref}`Log in <account-log-in-options>`
171
+
172
+
See also <https://myst-parser.readthedocs.io/en/v0.16.1/syntax/syntax.html#targets-and-cross-referencing>
173
+
166
174
### Images
167
175
168
176
A good documentation is just like a website enhanced and upgraded by adding high quality and self-explanatory images. Often images depict a lot of written text in a simple manner. Within our Sphinx docs, you can add them in two ways: a) add a PNG image directly and include or b) use inline description languages like GraphViz (current only option).
0 commit comments