Install tooling¶
This section takes you through the core installation steps for the tools needed to author your document as a static website and PDF file. The instructions are for macOS, Windows 11, and Linux (Ubuntu/Debian). If you are using a different operating system, please refer to the official documentation for that operating system.
Tip
The screenshots below may have small text on your screen but you can click on an image to enlarge it. The glightbox viewer will open the image in a new tab and you can zoom in to see the details.
The install and configuration starts with the setup of Visual Studio Code.
Install Visual Studio Code¶
Visual Studio Code (VS Code) is the editor we have chosen for developing the documentation using Zensical. You can use other editors, but the availability of many plugins in Visual Studio Code will help you edit your documentation more efficiently.
The steps below will help you install VS Code and some essential plugins to edit your documentation. If you have already installed VS Code, check through the steps so you have the plugins installed.
Install Visual Studio Code¶
Start with installing Visual Studio Code. Instructions for macOS, Windows 11, and Linux (Ubuntu/Debian) are below.
-
Install Visual Studio Code
- Open the Terminal application.
-
You are likely to already have Homebrew installed, but if not, follow the instructions on brew.sh to install it. Close and reopen your Terminal after installing it. As the installer adds
brewto yourPATH, and a session that was already open won't pick that up. -
Use the Homebrew package manager to install Visual Studio Code in your Terminal:
- Download the VS Code User setup for Windows from the official website.
- Run the installer,
VSCodeUserSetup-{version}.exe. By default the User setup installs Visual Studio Code to your user profile directory. You can change the install location if you want to install it for all users.
- Download the
.debpackage from the official website. - Open a terminal and navigate to the directory where you downloaded the
.debpackage. - Run the following command to install Visual Studio Code:
Replace
<file>with the name of the downloaded.debfile.
Further installation instructions are available on the Visual Studio Code website.
Install Git with Visual Studio Code¶
Git is a version control system that enables you to track changes to your code and collaborate with others. You will be using Git to manage your documentation website and push your changes to your GitLab or GitHub cloud repository.
Next, install the git command and configure it for Visual Studio Code. The instructions below are for use with both GitLab and GitHub.
Install and configure Git¶
Start by installing Git and configuring it for Visual Studio Code. The instructions below are for macOS, Windows 11, and Linux (Ubuntu/Debian).
-
As a start, you need to install the
gitcommand. Follow the instructions below to install or updategitto the latest stable version.-
Install Git
Use the Homebrew package manager to install or update
gitto the latest stable version:Open up a PowerShell Administrator window and install
gitusing the command, or you can download and install the official git installer from git-scm.com.If you just require an updated version of
git, you can run the following command in PowerShell:Close down PowerShell and reopen it after installing or updating
gitto ensure that the new version is available in yourPATH. Check the version ofgitinstalled by running the following command in PowerShell:
-
-
Before connecting to any cloud provider, open your terminal (Terminal on macOS/Debian, Git Bash or PowerShell on Windows 11) and set your global username. This is the identity stamped onto your commits.
Then set the email address to go with it. Make sure it's the same one you used to register for your GitLab or GitHub account.
Already use Git for other projects?
--globalapplies everywhere, on this project and every other one on your machine - the only option available right now, since you haven't cloned anything yet to scope it to. If you already have a Git identity set up for your own projects, run both commands again with--localinstead once you've cloned the template below, so this project's commits use these details without changing your identity anywhere else. -
Register for an account on the public GitLab or GitHub cloud instance you will use. If you have already registered, you can skip this step.
Generate and configure ssh keys for Git¶
Now generate the ssh keys to use for authentication with your GitLab or GitHub account and configure your ssh settings to use these keys.
-
Follow the instructions below to generate a new SSH key pair and add it to your account. It's best practice to use a modern, secure
ed25519key.-
Generate SSH keys
-
Open the Terminal application.
-
Generate the key for GitHub. Only the email address needs changing - the rest of the command is complete as written:
-
Then generate a separate key for GitLab:
-
When prompted, type a strong passphrase. You are asked once per key, so this happens twice.
- Open the PowerShell application.
-
Create the
.sshfolder, if it doesn't already exist: -
Generate the key for GitHub. Only the email address needs changing - the rest of the command is complete as written:
-
Then generate a separate key for GitLab:
-
When prompted, type a strong passphrase. You are asked once per key, so this happens twice.
-
Open the Terminal application.
-
Generate the key for GitHub. Only the email address needs changing - the rest of the command is complete as written:
-
Then generate a separate key for GitLab:
-
When prompted, type a strong passphrase. You are asked once per key, so this happens twice.
-
gitxxxin the steps that followYou now have two key files,
id_ed25519_githubandid_ed25519_gitlab. The remaining steps are written once, withgitxxxstanding for whichever of the two you are working on - so run them twice, substitutinggithuband thengitlab. -
-
Then configure the SSH config file to use the correct key for each service.
-
Edit the SSH config file
Open the file in your preferred text editor (create it if it doesn't exist) - for example with
nano:Paste in the configuration below, then save and close (
Ctrl+Oto save,Ctrl+Xto exit, in nano).Create the file from PowerShell first, then open it - creating it directly inside an editor risks Notepad naming it
config.txtinstead ofconfig:(Use
notepadin place ofcodeif you'd rather not use VS Code.) Paste in the configuration below, then save.The file must be called
config, with no extensionNotepad silently appends
.txtunless you prevent it, and Windows hides known extensions in File Explorer, soconfig.txtlooks identical toconfig. SSH reads only a file named exactlyconfig- a misnamed one is ignored entirely, andgit clonefalls back to asking for a password that will never be accepted. Creating the file withNew-Itemfirst avoids this. To check, and fix it if needed:Open the file in your preferred text editor (create it if it doesn't exist) - for example with
nano:Paste in the configuration below, then save and close (
Ctrl+Oto save,Ctrl+Xto exit, in nano).
The configuration to paste in:
# GitLab Host gitlab.com HostName gitlab.com User git IdentityFile ~/.ssh/id_ed25519_gitlab AddKeysToAgent yes # GitHub Host github.com HostName github.com User git IdentityFile ~/.ssh/id_ed25519_github AddKeysToAgent yesMake sure to replace the paths with the correct paths to your SSH keys if you used different names or locations.
AddKeysToAgent yesis what makes the key-loading step below self-healing - without it, the key you add to the agent today is gone the next time the agent restarts (a reboot, a logout, on some setups just time), and SSH fails with a permission error that looks like a rejected key rather than a missing one, since the public half still authenticates fine and only the signing step - which needs the private half - actually fails.On macOS, add one more line
Add
UseKeychain yestoo, in eachHostblock above, so macOS can supply the passphrase from your login keychain instead of asking every time - paired with--apple-use-keychainonssh-addbelow. This directive is Apple-specific: don't add it on Windows or Linux, where it isn't recognised and breaks everysshcommand that reads this file withBad configuration option: usekeychain.Tip
Separate keys per account are safer, but if you reuse one, add its public key to each account separately in Integrate Visual Studio Code with Git below.
-
-
Set the correct permissions for the SSH config file and the private key(s) to ensure they're secure. If you are using macOS or Linux, run the following commands in your terminal, substituting
gitxxxand paths to your SSH keys if you used different names or locations:Windows handles permissions differently and are normally set to only allow access to the user, but ensure that the private key(s) aren't accessible to other users.
-
You've set a passphrase for the SSH keys, so you'll need to enter it every time you use a key. To avoid this, you can use an SSH agent to cache your passphrase. Follow the instructions below to start the SSH agent and add your keys.
-
Adding SSH keys
-
macOS normally starts an SSH agent for you automatically. Add your SSH private keys to it, substituting
gitxxxwith eithergithuborgitlabdepending on which service you are adding the key for ---apple-use-keychainstores the passphrase in your login keychain, so the key survives a reboot instead of silently dropping out of the agent:If this fails with an error about not being able to connect to the agent, start one first, then repeat the command above:
-
Set the SSH agent to start automatically with Windows, and then start it. Run these in a PowerShell window opened as Administrator (right-click the Start menu, or search for PowerShell, then select Run as administrator):
Run in that order, in an Administrator window
Windows ships this service disabled, so
Set-Servicehas to take it out of that state beforeStart-Servicehas anything it's allowed to start - reversed, the first command fails withCannot start service ssh-agent. Both commands also need elevation: an ordinary window fails withAccess is denied, which then makes the second command fail too, for the same underlying reason.An Administrator PowerShell opens in
C:\WINDOWS\system32(an ordinary one opens inC:\Users\yourname), and its title bar says Administrator.Check it worked before moving on:
The Status column should read
Running. If it still saysStopped, confirm the PowerShell window really is running as Administrator - the title bar says Administrator when it is. -
Back in your normal (non-administrator) PowerShell window, add your SSH private keys to the agent, substituting
gitxxxwith eithergithuborgitlabdepending on which service you are adding the key for:
-
Add your SSH private keys to the running SSH agent, substituting
gitxxxwith eithergithuborgitlabdepending on which service you are adding the key for:Unlike macOS, Linux doesn't always start an SSH agent automatically. If the command above fails with an error about not being able to connect to the agent, start one first, then repeat the command above:
-
-
-
Display your public key, so you can copy it - the next section needs it pasted into your GitLab and GitHub accounts. Only the public key goes there; never paste the private one (the file with no
.pubextension).-
Display the public key
Substitute
gitxxxas before, and run it once for each key you generated. Select the entire line it prints - starting withssh-ed25519and ending with the email address you gave it - and copy it. -
Integrate Visual Studio Code with Git¶
-
Now that you've generated your keys and finished the configuration, add them to your GitHub and GitLab accounts using the instructions below.
-
Integrate Visual Studio Code with Git
- Log in to your GitLab account in a web browser.
- In the top-right corner, click on your profile avatar and select Edit profile.
- On the left-hand sidebar, select Access > SSH Keys.
- Click Add new key and fill out the following details:
- Title: Give it a clear name (e.g., VS Code Extension).
- Key: Paste the contents of your public SSH key file (e.g.,
~/.ssh/id_ed25519_gitlab.pub). - Expiration date: GitLab fills this in for you, one year ahead, and will not let you leave it empty. Set it well into the future - the end of your course or project, say - or you will be locked out mid-way through and have to generate and register a new key.
- Click Add key to save the key.
An expired key fails confusingly
When the date passes,
git pushandgit pullstop working with a permission error that looks like a misconfigured key rather than an expired one. If pushing suddenly fails having worked for months, check this date first.- Log in to your GitHub account in a web browser.
- In the top-right corner, click on your profile avatar and select Settings.
- On the left-hand sidebar, select SSH and GPG keys.
- Click New SSH key and fill out the following details:
- Title: Give it a clear name (e.g., VS Code Extension).
- Key: Paste the contents of your public SSH key file (e.g.,
~/.ssh/id_ed25519_github.pub).
- Click Add SSH key to save the key.
No expiry date to set here
Unlike GitLab, GitHub SSH keys have no expiration field - the key stays valid until you delete it, so there is nothing to set.
-
-
Test the SSH connection to GitHub and GitLab to ensure that the keys are working correctly. Run the following commands in your terminal:
If successful, you will see greetings like:
Cloning the prodockit-template¶
Cloning the documentation template creates a local copy of the template on your computer. You will then be able to edit the template locally in Visual Studio Code and publish your own documentation website.
Clone the prodockit-template¶
Start by cloning the template into your own local device.
-
If you don't have a directory for your git repositories, create one for all your GitLab or GitHub projects on your local desktop. For example, create a directory called 'GitLab' in your home directory.
-
Open a terminal (Terminal on macOS/Debian, Git Bash or PowerShell on Windows 11) and navigate to the directory you created in the previous step.
-
Then run the following command to clone the documentation template into your local directory. Use whichever tab matches the host you use.
-
Clone the template
Tip
You can find your
usernameby logging into your GitLab or GitHub account and clicking on your profile picture at the top right corner of the page. On GitLab your username is below your name in the dropdown menu. On GitHub your username is above your name in the dropdown menu. -
Point your clone at your own repository¶
If you have cloned a repository that has been given to you to work on and is not a direct copy of the template, you can skip this section.
Cloning gives you the template's files, but the clone still points at the template's repository. This section repoints it at a repository of your own - and is not a step to skip or leave for later, whichever of the two ways it goes wrong if you do:
Skipping this doesn't fail safely for everyone
If you don't have write access to the template, git push fails with a permission error - confusing the first time you see it, but harmless, and the fix is this section.
If you do have write access - a maintainer, a contributor, anyone who has ever been given push rights - git push succeeds, silently, straight into the template repository itself. That repository is public, and every future reader clones it. There is no error to notice and no prompt to confirm; the only protection is doing this section before your first commit.
The steps below have to happen in this order, not just as a numbered convention: step 3 (reset the history) deletes the repository's entire .git directory, which takes every remote with it - including origin, however it's currently set. Repoint origin at your own repository before resetting, and the reset undoes the repoint along with everything else, leaving you back at square one with no warning that it happened. Reset first, then repoint, as the steps below do.
-
Rename the directory to something meaningful for your own report. Cloning leaves you with a folder called
prodockit-template, which says nothing about whose work it holds - and if you clone a second project later, you will not be able to tell them apart.-
Rename the project folder
Replace
report-az1234with a name that identifies your own work - your username, your coursework code, or whatever your course tutor specifies.Renaming the folder doesn't rename the repository
This changes only the folder on your own machine. The project's name on GitLab or GitHub is unaffected, and so is the
originremote inside it -git pushandgit pullcarry on working exactly as before. -
-
Check what your clone currently points at:
-
Check the current remote
A fresh clone has exactly one remote,
origin, pointing at the template:origin git@github.com:buckwem/prodockit-template.git (fetch) origin git@github.com:buckwem/prodockit-template.git (push)graph LR L[Your local clone] -->|origin| T[prodockit-template]1. Right after cloning:
originpoints at the templateIf you added any others of your own - a
gitlabmirror, say - they will be listed here too. You do not need to remove any of them by hand: the next step deletes the repository's entire.gitdirectory, which takes every remote with it. -
-
Start with a fresh commit history. This is your own independent project, so carrying the template's entire commit log and branches from the template into it serves little purpose.
-
Reset the repository history
rm -rf .gitcannot be undoneThis permanently deletes the repository's history from your machine - every commit, branch and tag. There is no undo, and nothing to recover from, because the deleted history is the thing that would have recovered it. Make sure you are in the right directory (
pwd) and that you have pushed anything you care about somewhere else first.Remove-Item -Recurse -Force .gitcannot be undoneThis permanently deletes the repository's history from your machine - every commit, branch and tag. There is no undo, and nothing to recover from, because the deleted history is the thing that would have recovered it. Make sure you are in the right directory (
pwd) and that you have pushed anything you care about somewhere else first.rm -rf .gitcannot be undoneThis permanently deletes the repository's history from your machine - every commit, branch and tag. There is no undo, and nothing to recover from, because the deleted history is the thing that would have recovered it. Make sure you are in the right directory (
pwd) and that you have pushed anything you care about somewhere else first.
Why
core.fileMode falseGit records whether a file is executable, and treats a change to that bit as a change to the file. Cloud-sync clients - OneDrive in particular - rewrite those bits as they sync, so a folder that syncs can show every file in the project as modified when not one byte of content has changed. Turning it off tells git to ignore the executable bit entirely.
It is set per repository and is not committed, so it has to be repeated on each machine and after each fresh clone. If you keep all your work in a synced folder,
git config --global core.fileMode falsesaves repeating it - thoughgit initandgit cloneeach write their own local setting, which still wins.rm -rf .git/Remove-Item -Recurse -Force .gitdeletes the whole repository, remotes included, andgit initstarts a brand new one with none at all:graph LR L[Your local clone - no remotes]2. After resetting the history: no remotes at all
Run
git remote -vat this point and it prints nothing. -
-
Create the new, empty repository on the host you are publishing to. Do not add a README,
.gitignoreor licence - the template brings its own, and an initial commit on the host side collides with what you are about to push.-
Create the empty repository
On the GitLab website, click New project > Create blank project. Name it, set Visibility Level to Private, and untick Initialize repository with a README.
On the GitHub website, click New repository. Name it, set it to Private, and leave every Initialize this repository with option unticked.
-
-
Point your clone at your own repository, using the tab matching your host:
There is nothing to remove first
Deleting
.gitin step 3 took the template'soriginwith it, along with any other remotes you saw in step 2 -git initstarts a repository with none at all. If you rungit remote remove originout of habit, Git tells you so:That message means the previous step did its job, not that anything is wrong.
-
Point the clone at your repository
Confirm it took:
graph LR L[Your local clone] -->|origin| R[Your own repository]3. After repointing:
originpoints at your own repositoryoriginnow points at your own repository rather than the template's - compare this against the first diagram in this section, where it pointed atprodockit-templateinstead.Don't commit or push yet
Step 3 left you with an empty repository - the template's files are all still there, but Git is tracking none of them yet.
Resist committing them now. The template's files still name the template's repository in several places, and
prodockit sync-repoin the next section is what repoints them at yours. Committing first would put those stale references into your project's very first commit, and you would then be correcting them in the second.Install Python and Zensical ends with the
git add,git commitandgit pushthat publish everything in one go, once there is something correct to publish. -
We are not complete with the setup yet, but you now have a local copy of the template that is connected to your own repository on GitLab or GitHub. Do not start editing yet, as the next section installs Python, Zensical and prodockit, which are needed to build your documentation.
Install Python and Zensical¶
Here are brief instructions for installing Python are below for macOS, Windows 11, and Linux (Ubuntu/Debian). However, it's recommended to refer to the official Python installation documentation for your operating system.
Note
You may need to use 'python3' and 'pip3' instead of 'python' and 'pip' depending on your system configuration.
The instructions below are for installing Python 3.12 or later. If you have an older version, please update to Python 3.12 or later.
-
Follow the instructions below to install Python, create a virtual environment, and install Zensical inside it for your operating system.
-
Install Python, Zensical and prodockit
-
If you use the Homebrew package manager, run this command in your Terminal to install Python. If you don't have Homebrew installed, you can install it by following the instructions on the Homebrew website.
-
Install Pango, which is not a Python package, so
pipcannot install it for you: -
Install Pandoc at the version this project builds with. Homebrew always installs the newest release, which is why it is not used here - see Which pandoc version below:
curl -fsSL -o /tmp/pandoc.pkg "https://github.com/jgm/pandoc/releases/download/3.10.1/pandoc-3.10.1-arm64-macOS.pkg" sudo installer -pkg /tmp/pandoc.pkg -target /On an Intel Mac, use
pandoc-3.10.1-x86_64-macOS.pkginstead.Why Pango but a fixed Pandoc
prodockit pdfshells out topandoc, which hands the result to WeasyPrint to lay out the pages - and WeasyPrint draws text through Pango, sopangoalone is enough (glib, HarfBuzz and fontconfig come along as its dependencies). Skipping either still looks fine right up untilprodockit pdf, which then fails withpandoc exited with status 43- see WeasyPrint cannot start (status 43) if that happens. -
Install the desktop font files this template's PDF uses by default - Inter and JetBrains Mono:
Why this early
The website loads its fonts from a CDN at view time, but the PDF has no such fallback - WeasyPrint has to embed the actual font files, and silently substitutes a fallback font instead of erroring if they are missing. See Fonts for the full picture, including how to check the right fonts actually made it into a built PDF.
-
Open Terminal in your project folder and run the following commands to create a virtual environment and install Zensical inside it:
# 1. Create the virtual environment /opt/homebrew/bin/python3 -m venv .venv # 2. Activate it source .venv/bin/activateYour prompt gains a
(.venv)prefix, which is how you know the virtual environment is active:It disappears when you close the terminal, and every new one needs activating again - or let VS Code do it, which the Python extension below handles for you.
Why the full path to Python
macOS ships its own older Python, and a plain
python3may well find that one instead of Homebrew's. Naming/opt/homebrew/bin/python3explicitly builds the virtual environment from the version you just installed. On an Intel Mac, Homebrew installs to/usr/localinstead, so use/usr/local/bin/python3.
-
Download and run the official Python installer from python.org.
Three things to get right during install
- Check Add python.exe to PATH on the first screen. This is what lets you run
pythonfrom the command line at all, and also putspipand every command it installs on yourPATH. - Once installation finishes, a final screen offers Disable path length limit - click it. Windows historically caps a full file path at 260 characters, and this project's own dependencies nest deep enough (
.venv\Lib\site-packages\...,tools\mermaid\node_modules\...) to hit that limit without it. - Make sure you are running the installer you just downloaded, not Windows' own placeholder. Typing
pythonin a terminal with no real Python installed opens the Microsoft Store instead of running anything - if that still happens after installing, search Manage app execution aliases and turn off the App Installer entries forpython.exe/python3.exe, which take priority over the one you just installed.
- Check Add python.exe to PATH on the first screen. This is what lets you run
-
Next install pandoc, which is not a Python package, so
pipcannot install it for you. Open PowerShell and run the following command:The package is under its author's name, not
Pandocwinget identifies packages as
Publisher.Package, and Pandoc's publisher is its author, John MacFarlane. There is noPandoc.Pandoc, so guessing that gives:winget search pandoclists the real identifier if you ever need to check it. -
Install the graphics libraries WeasyPrint needs. Pandoc hands your document to WeasyPrint to lay out the pages, and WeasyPrint is not pure Python - it draws text through Pango, which on Windows comes from MSYS2. Install MSYS2 first:
Then open the MSYS2 MINGW64 shell from your Start menu (not PowerShell) and run:
If that fails partway through with a download error, just run it again - MSYS2's mirrors are occasionally flaky, and a second attempt usually goes through cleanly.
Finally, add
C:\msys64\mingw64\binto your userPATH, the same way you added Python: search for Edit the system environment variables, click Environment Variables, select Path under User variables, and add that folder. Close and reopen PowerShell afterwards so the change takes effect - the next two steps continue in that new window.No virtual environment to reactivate yet
Unlike other "close and reopen PowerShell" steps on this page, there's nothing to
cdback to or activate here. The virtual environment isn't created until step 5 below - reopening PowerShell now just gets thePATHchange into a fresh window before continuing.Why this is needed
That folder is where WeasyPrint finds
libgobject-2.0-0.dll,libpango-1.0-0.dll,libharfbuzz-0.dllandlibfontconfig-1.dll- installingpangobrings all four in. Skipping this still looks fine untilprodockit pdf, which then fails withpandoc exited with status 43- see WeasyPrint cannot start (status 43) if that happens. -
Install the desktop font files this template's PDF uses by default - Inter and JetBrains Mono. Download the desktop (
.ttf/.otf) files for each - Inter, JetBrains Mono - then select them all, right-click, and choose Install for all users.Why this early
The website loads its fonts from a CDN at view time, but the PDF has no such fallback - WeasyPrint has to embed the actual font files, and silently substitutes a fallback font instead of erroring if they are missing. See Fonts for the full picture, including why a
.woff/.woff2download will not do, and how to check the right fonts actually made it into a built PDF. -
Allow PowerShell to run scripts. Windows blocks all of them by default, and activating a virtual environment is a script, so this has to be done once before the next step will work:
Depending on your PowerShell version it may ask you to confirm the change; answer
Yif it does. Often it simply returns to the prompt, which means it worked.What this changes
Without it, activating the venv fails with
... cannot be loaded because running scripts is disabled on this system.RemoteSignedallows locally-written scripts while still requiring signed ones from the internet;-Scope CurrentUserlimits that to your account, so it needs no Administrator window and is a one-time, per-account change.Would rather not change it at all? Use classic CMD instead of PowerShell and run
.\.venv\Scripts\activate.batin the next step -.batfiles aren't covered by execution policy. -
Change into your project folder, then create a virtual environment and install Zensical inside it:
Check where you are first
The steps above will have moved you. The SSH agent needed an Administrator window, which opens in
C:\WINDOWS\system32, and every "close and reopen PowerShell" leaves you in your home directory,C:\Users\yourname.python -m venv .venvdoes not object to either. It creates a perfectly good virtual environment in the wrong place, and the mistake only shows up a step later whenpip install -r requirements.txtcannot find a file that is sitting in your project folder all along.pwdprints where you are.# 1. Create the virtual environment python -m venv .venv # 2. Activate it (choose the line matching your terminal) .\.venv\Scripts\Activate.ps1 # <-- Use this if you are in PowerShell .\.venv\Scripts\activate.bat # <-- Use this if you are in classic CMDYour prompt gains a
(.venv)prefix, which is how you know the virtual environment is active:It disappears when you close the terminal, and every new one needs activating again - or let VS Code do it, which the Python extension below handles for you.
-
Open a terminal and run the following command to install Python, the
venvmodule, pandoc, the graphics libraries WeasyPrint needs, and the fonts this template's PDF uses by default. None of these is a Python package, sopipcannot install them for you:sudo apt update sudo apt install python3 python3-venv python3-pip curl \ libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 \ fonts-inter fonts-jetbrains-monoUbuntu's own
pandocpackage is several major versions behind, far enough to change how the PDF renders, so install the pinned release directly - see Which pandoc version below. This picks theamd64orarm64package to match your CPU, so it also works on Ubuntu running under an Apple Silicon Mac:curl -fsSL -o /tmp/pandoc.deb "https://github.com/jgm/pandoc/releases/download/3.10.1/pandoc-3.10.1-1-$(dpkg --print-architecture).deb" sudo apt install -y /tmp/pandoc.debWhy the three library packages
Pandoc hands the result to WeasyPrint, which draws text through Pango and won't start without it.
libharfbuzz-subset0is easy to miss - on Debian it's a separate package fromlibharfbuzz0b, and WeasyPrint needs this one specifically (glib and fontconfig aren't listed, sincelibpango-1.0-0already depends on them). Skipping this still looks fine untilprodockit pdf, which then fails withpandoc exited with status 43- see WeasyPrint cannot start (status 43) if that happens.Debian 12 or Ubuntu 22.04 and newer
libharfbuzz-subset0does not exist on older releases. On those, upgrade the distribution rather than hunting for a substitute package.Why the fonts, this early
The website loads its fonts from a CDN at view time, but the PDF has no such fallback - WeasyPrint has to embed the actual font files, and silently substitutes a fallback font instead of erroring if they are missing. Skipping this still looks fine right up until your first
prodockit pdf, whose test suite (if you run one - see Testing) then fails withNo 'Inter' font found anywhere in the compiled PDF. See Fonts for the full picture, including how to check the right fonts actually made it into a built PDF. -
Navigate to your project folder and run the following commands to create a virtual environment and install Zensical inside it:
# 1. Create the virtual environment python3 -m venv .venv # 2. Activate it source .venv/bin/activateYour prompt gains a
(.venv)prefix, which is how you know the virtual environment is active:It disappears when you close the terminal, and every new one needs activating again - or let VS Code do it, which the Python extension below handles for you.
-
-
-
Install Zensical and prodockit inside the virtual environment. The
requirements.txtfile in the template lists the required packages, so you can install them all with a single command (usepipifpip3is not available): -
Check that the
prodockitcommand actually resolves to the one you just installed:pipexiting without an error only means the package landed in.venv- it doesn't prove your shell finds it there first. An older, separately-installedprodockitearlier on yourPATHshadows it silently, and every command in this guide from here on would run against that instead. -
Check that WeasyPrint can find its graphics libraries. This is the one part of the setup
pipcannot verify for you, so it is worth confirming now rather than at your first PDF build:A version number means everything is in place. If instead you get a long error ending in
cannot load library, the libraries from the step above are missing or cannot be found - go back and install them. -
Fetch the citation style your first build needs. The template enables
prodockit.bibliographyby default, pointingcsl_styleatharvard-cite-them-right.csl- but that file isn't part of the clone, sozensical serve/zensical build/prodockit pdfall fail outright until it's in place. Fetch it once, from your project root:-
Fetch the citation style
See An alternative: prodockit.bibliography for what this feature does, and how to fetch a different CSL style instead.
-
-
Sync the repository's own self-references to match. The template's files still name the template's repository in several places, and nothing about changing a Git remote updates them:
It reports what it changed:
Detected GitLab remote (https://gitlab.surrey.ac.uk/az1234/report-az1234); updated: repo_url, repo_name, theme.icon.repo, README badgesThis rewrites
repo_url,repo_name,theme.icon.repoandedit_uriinzensical.toml, plus the badge row in yourREADME.md, to match theoriginyou just set - so your built site and PDF link to your own repository rather than the template's. Notetheme.icon.repoin that list: moving from a GitHub template to a GitLab project switches the header's brand icon to match, which is easy to miss by hand. Only the values that actually needed changing are listed, so the set you see may be smaller.Check it any time
prodockit sync-repo --checkwrites nothing and exits non-zero if these have drifted from your remote - useful after any later change of host. See Checks worth having. -
Lets now commit the changes to your own repository. Run the following commands to commit and push the changes:
Which pandoc version¶
Every command above installs pandoc 3.10.1 specifically, rather than whatever your package manager considers current. This project is built and tested against that version, and pandoc is not always compatible with itself across releases: 3.10 changed how it reads highlighted code in HTML, in a way that broke every fenced code block in the PDF while the build still reported success - see Pandoc version drift for what that looked like.
Confirm which version you actually have:
The first line should read pandoc 3.10.1. If it doesn't - a
Homebrew upgrade, a distribution update, or winget upgrade run
without thinking about it will all move this - repeat the pandoc
install step above for your platform to bring it back.
Install Zensical Studio and other plugins¶
Now we'll install the Zensical Studio plugin for Visual Studio Code, which provides a set of tools to help you work with Zensical projects, including commands to build and preview your site. Then we'll install a couple of other useful plugins for working with Markdown and TOML files.
- Start by opening Visual Studio Code and navigating to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing
Ctrl+Shift+X/Cmd+Shift+X. -
Install the Python extension (published by Microsoft) by searching for "Python" in the Extensions view and clicking Install. As well as Python support, this is what makes VS Code notice the
.venvfolder in your project and activate the virtual environment automatically in every new Terminal in VS Code - so you don't have to runsource .venv/bin/activateby hand each time you open one.Tip
Check it worked by opening a new terminal (Terminal > New Terminal) - the prompt should start with
(.venv). If it doesn't, reopen VS Code in the project folder, then choose Python: Select Interpreter from the Command Palette (Ctrl+Shift+P/Cmd+Shift+P) and pick the one inside.venv. -
Install the Zensical Studio extension by searching for "Zensical Studio" in the Extensions view and clicking Install and then Trust Publisher and Install when prompted. This extension provides a set of tools to help you work with Zensical projects, including commands to build and preview your site.
-
Follow the instructions on the Zensical Studio plugin page to configure the extension. You may find the configuration aleady exists but if it's not there add to the
.vscode/settings.jsonfile in your project directory the following lines: -
Install the Even Better TOML extensiuon for Visual Studio Code by searching for "Even Better TOML" in the Extensions view and clicking Install and then Trust Publisher and Install when prompted. This extension provides syntax highlighting and other features for working with TOML files, which are used for configuration in Zensical projects.
-
Install the LTeX+ – LanguageTool grammar/spell checking plugin for Visual Studio Code by searching for "LTeX+" in the Extensions view and clicking Install and then Trust Publisher and Install to enable spelling and grammar checking for Markdown. Configure the plugin's language setting to whichever English (or other language LTeX+ supports) you're actually writing in.
Get this right, or corrections are confidently wrong
Set to the wrong variety, LTeX+ still checks every sentence - it just checks it against the wrong rules, and offers "corrections" for perfectly correct spelling and phrasing in the variety you're actually using. That's worse than no checking at all, since a wrong suggestion looks exactly as confident as a right one.
There are many other extensions available for Visual Studio Code that can help you with your documentation. You can explore the Visual Studio Code Marketplace to find more extensions that suit your needs.
Install the diagram and maths tooling¶
Two things your document can contain - diagrams and mathematical notation - need tooling that none of the steps so far has installed.
On the website they look after themselves: the reader's browser draws them as the page loads. A PDF has no browser, so prodockit pdf converts both into images before building the document, using two Node.js programs to do it.
Without these, the PDF is wrong rather than missing
prodockit pdf does not fail when they are absent. It leaves the content as it found it, so instead of a flowchart your PDF shows the diagram's own definition text - the graph LR line and every node written out beneath it - and instead of a typeset equation, raw LaTeX with all its backslashes and braces.
Meanwhile the website renders both perfectly. So nothing looks wrong until somebody opens the PDF, which may be well after you have written the document.
Install Node.js¶
The two tools are Node.js programs, so install Node.js first. Version 22 or newer - that is what the automated builds use.
-
Install Node.js
Close and reopen PowerShell afterwards, so it picks up the new
PATH. The new window starts inC:\Users\yournamewith the virtual environment inactive, so get back to where you were before continuing:Check the prompt starts with
(.venv)again. The next step'snpm cicommands are relative to your project folder, and everyprodockitcommand after it lives inside the virtual environment - outside it, PowerShell reportsThe term 'prodockit' is not recognized.Ubuntu's own
nodejspackage is often several versions behind. Use NodeSource's repository to get a current release:sudo apt update sudo apt install -y curl curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt install -y nodejsDon't skip the
curllineA clean Ubuntu install does not necessarily have
curl. Without it the first command fails withCommand 'curl' not found- and the failure does not stop there, because theapt installon the next line still succeeds, quietly fitting Ubuntu's own older Node.js instead of NodeSource's.You then have a
nodethat looks installed but nonpmat all, and the toolchain commands in the next section fail for what appears to be an unrelated reason. If you have already hit this, installcurland run the two NodeSource lines again - the correct package replaces the wrong one.
Check it worked - both commands, not just the first:
You should get two version numbers, with node at 22 or above:
node answers but npm is not found
That is the signature of the NodeSource step not having run - the most likely cause on Linux being the missing curl described above. Node came from your distribution's own package instead, which does not always bring npm with it.
Fix the earlier step and run it again rather than installing npm separately, so both come from the same source and stay in step.
Install the two toolchains¶
Your cloned template already contains the manifests and lockfiles for both tools, in tools/mermaid and tools/mathjax - so you only need to install them.
If you're on Linux, install a native Chromium and point Puppeteer at it before running npm ci below, rather than letting tools/mermaid's own npm ci download one for you - Puppeteer's download is not guaranteed to match your CPU's architecture. This matters most on ARM64 machines (an Apple Silicon Linux VM, an AWS Graviton instance, a Raspberry Pi), where npm ci would otherwise silently fetch an x86_64 Chrome build it can never run, but it costs nothing to do on any Ubuntu install:
The second command should print a path such as /usr/bin/chromium-browser or /usr/bin/chromium - that's what the next step needs. Point Puppeteer at it, and skip its own download entirely, for this session, then make both permanent so every future session picks them up too:
export PUPPETEER_EXECUTABLE_PATH=$(which chromium-browser || which chromium)
export PUPPETEER_SKIP_DOWNLOAD=true
echo 'export PUPPETEER_EXECUTABLE_PATH=$(which chromium-browser || which chromium)' >> ~/.bashrc
echo 'export PUPPETEER_SKIP_DOWNLOAD=true' >> ~/.bashrc
source ~/.bashrc
Open a new terminal for this step (it picks up the exports above from ~/.bashrc automatically), and make sure it's actually sitting in your project's root directory first - the --prefix paths below are relative to wherever you run them from:
Then install both:
npm ci installs the exact versions recorded in each lockfile, which is what the automated builds use too - so your PDF is rendered by the same versions as the published one.
This creates a node_modules folder inside each, which is deliberately not committed (see .gitignore). Run these two commands again if you ever re-clone the project.
Install the MathJax bundle the website itself needs, from the tools/mathjax install you just ran. It isn't committed - it's third-party code, and a repository is redistribution - so this step is what makes formulas render at all until you run it, on every machine that needs to see them, including CI (see Diagrams and maths):
mkdir -p docs/javascripts/vendor/mathjax
cp tools/mathjax/node_modules/mathjax-full/es5/tex-svg-full.js docs/javascripts/vendor/mathjax/
cp tools/mathjax/node_modules/mathjax-full/LICENSE docs/javascripts/vendor/mathjax/
Then write the config MathJax needs to actually process the formulas your document contains - without it, every equation renders as raw TeX, with nothing in the build to say why:
cat > docs/javascripts/mathjax.js <<'MATHJAX'
window.MathJax = {
tex: {
processEscapes: true,
processEnvironments: true,
},
options: {
ignoreHtmlClass: ".*|",
processHtmlClass: "arithmatex",
},
};
MATHJAX
If npm reports vulnerabilities or an allow-scripts warning
Both are normal here, not a sign anything went wrong:
Run `npm audit` for details.
npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts:
npm warn allow-scripts puppeteer@25.3.0 (postinstall: node install.mjs)
The vulnerability count comes from npm audit scanning the whole dependency tree Puppeteer pulls in for known advisories, most of which don't apply to how this project uses it - a locally-run PDF build, not a public-facing server. There's nothing to fix here; running npm audit fix is more likely to break the pinned versions the lockfile records than to help.
The allow-scripts warning is different: recent npm versions skip Puppeteer's own setup step, which downloads the headless browser Mermaid draws diagrams with. The install still succeeds - if a later PDF build reports it cannot find a browser, approve the step and reinstall:
Starting a project that isn't from the template?
Then you have no tools/ directory to install from, and need prodockit init-tools first to create it. Running it on a copy of the template is harmless but pointless - it will just report Kept existing tools/mermaid/package.json for each file it finds. See Diagrams and maths for the full picture.
Test the whole thing by building the PDF - see Generate the Source and PDF documents in the next section. If a diagram appears as an image rather than as text, everything is set up correctly. None of this is required if your document has no diagrams or formulas, but setting it up now costs nothing and means the trap above can't catch you later when you add your first one.
Where to go next¶
You now have Visual Studio Code, Git, Zensical and the diagram and maths tooling installed, and your own copy of the documentation template cloned locally. Continue to Start editing to preview your changes locally and publish them to GitLab or GitHub.