Create & edit documents#
This page assumes a basic working knowledge of Mercurial. Many tutorials are available on the internet; here are a few starting points.
Mercurial Kick Start (also available in French)
Clone a repository#
Documents are grouped into sites, which represent the unit of deployment. Each site is tracked as a Mercurial repository.
Clone the repository with (substitute
SITEwith the name of the site):hg clone -u main https://rc.t-doc.org/hg/SITEIf the command asks for a username and password, ensure you have set up the Mercurial configuration as described in "Install".
The typical structure of a site repository is shown below. The source files are
located below the docs directory.
├── .github
│ └── workflows
│ └── publish.yml A workflow to publish the site
├── docs
│ ├── conf.py The Sphinx configuration
│ ├── index.md The main index page
│ └── ... The source documents
├── .gitignore
├── .hgignore
├── LICENSE.txt
├── README.md
├── run.desktop A desktop entry to run the local server on Linux
└── run.py An auto-installing wrapper for the tdoc command
Edit documents#
Run the local server.
Double-click the file
run.pyin the repository root. Make sure that.pyfiles are associated with Python by default.Alternatively, open a terminal, change to the repository root, and run:
run.pyOpen a terminal, change to the repository root, and run:
./run.pyDouble-click the file
run.desktopin the repository root.Alternatively, open a terminal, change to the repository root, and run:
./run.pyThe server renders the source files into HTML, and serves the site over HTTP.
Running Sphinx loading translations [fr]... done making output directory... done (...) build succeeded. The HTML pages are in _build\serve-8000-next\html. Serving at <http://localhost:8000/>
Navigate to
http://localhost:8000/to view the generated pages.Create and edit documents in the
docsdirectory. This can be done with any plain text editor.The local server watches the source files and automatically rebulids the HTML when a file changes.
When the build is successful, the browser automatically reloads all open pages.
If a build fails, the errors can be viewed in the terminal.
After the initial full build of all pages, the server rebuilds only pages that change. This is much faster, but can sometimes cause artifacts or failures. If this happens, restart the local server to trigger a full rebuild, and report the issue to t-doc's authors.
Stop the local server by clicking the button in the header, by typing Ctrl+C in the terminal, or by closing the terminal window.
Don't forget to commit changes frequently.
Deploy documents#
To deploy the site to tdoc.org:
Make sure that all changes have been committed (and that new files have been added with Mercurial).
Push the changes to the server.
hg pushThe changes should be live at
https://SITE.t-doc.org/within a few minutes. If the build fails, GitHub should send you an email notification. It contains a link to the build log, which should allow figuring out what went wrong.