Improve Test the Ulwazi theme guide#588
Conversation
jahn-junior
left a comment
There was a problem hiding this comment.
Thanks! I left some optional suggestions on wording.
Co-authored-by: JJ Coldiron <jj.coldiron@canonical.com>
jahn-junior
left a comment
There was a problem hiding this comment.
Thanks! I left one additional comment, but you've addressed the rest of my suggestions.
| Use this approach if you want to preserve as much of your original `conf.py` as possible, for example in a heavily customised deployment or when troubleshooting a configuration issue. | ||
|
|
||
| ### Set the theme | ||
| For an example of all the changes, see the [Charmed Apache Kafka Ulwazi PR](https://github.com/canonical/kafka-operator/pull/444/files#diff-85933aa74a2d66c3e4dcdf7a9ad8397f5a7971080d34ef1108296a7c6b69e7e3). |
There was a problem hiding this comment.
Nitpick: The PR includes many other changes (formatting, etc.) that need to be ignored to see the Ulwazi-specific ones.
If providing an example diff/PR like this, it should be against the vanilla SP and free of anything else than the Ulwazi changes.
I realize that's likely out of scope of this PR, so I'd rather leave this out.
|
|
||
| Updating the project configuration is the most critical step in this process. | ||
|
|
||
| There are two main ways to do that: |
There was a problem hiding this comment.
| There are two main ways to do that: | |
| There are two main ways: |
| ## Update the dependencies | ||
|
|
||
| In your project's Python requirements, replace the canonical-sphinx package with Ulwazi and its dependencies. The minimum set is: | ||
| In your project's Python requirements (`requirements.txt`), replace the Canonical Sphinx package with Ulwazi and its dependencies: |
There was a problem hiding this comment.
It's unclear to me what's meant here by "Ulwazi's dependencies". A lot of these extensions already exist in the default starter pack extensions.txt.
There was a problem hiding this comment.
That's a great point, that leads me to an idea of separating minimum dependencies from the ones we use in our Ulwazi demo. I'll add it as a feature request to our GitHub issues.
|
|
||
| ### Set the theme | ||
| The following instructions describe the modifications needed to support Ulwazi in an existing `conf.py` file. | ||
| Use this approach if you want to preserve as much of your original `conf.py` as possible, for example in a heavily customised deployment or when troubleshooting a configuration issue. |
There was a problem hiding this comment.
| Use this approach if you want to preserve as much of your original `conf.py` as possible, for example in a heavily customised deployment or when troubleshooting a configuration issue. | |
| Use this approach if you want to preserve as much of your original `conf.py` as possible, for example in a heavily customized deployment or when troubleshooting a configuration issue. |
| * Simple way -- Adapt the [Sample `conf.py` for Ulwazi](https://github.com/canonical/ulwazi/blob/main/docs/default-conf.py) by adjusting the values for your specific documentation. | ||
| * Hard way -- Adapt your existing configuration by adding all required values. | ||
|
|
||
| We strongly recommend trying the first option (the simple way) first as it proved to be faster and less troublesome, yet enough for testing the theme. |
There was a problem hiding this comment.
| We strongly recommend trying the first option (the simple way) first as it proved to be faster and less troublesome, yet enough for testing the theme. | |
| We strongly recommend trying the simple way first as it proved to be faster and less troublesome, yet enough for testing the theme. |
| copyright = f"{datetime.date.today().year}" | ||
| ``` | ||
|
|
||
| The license information is now conveyed through the "license" key in "html_context". |
There was a problem hiding this comment.
| The license information is now conveyed through the `license` key in `html_context`. |
| + sphinx-last-updated-by-git | ||
| + sphinx-sitemap | ||
| + sphinx-terminal | ||
| + ulwazi |
There was a problem hiding this comment.
I would add sphinx-modern-pdf-style here as well. If someone follows the simpler approach described below, then sphinx_modern_pdf_style is included in the extensions list in default_conf.py, and the instruction to add sphinx-modern-pdf-style to requirements.txt only appears in the instructions for the harder approach. Might as well include it in the default requirements.txt even if not every docs set needs it (not every docs set needs myst-parser either but it's included).
| ``` | ||
|
|
||
| Add these entries to configure the settings related to your GitHub repository. | ||
| `default_edit_url` and `default_view_url` serve as fallback URLs for the view/edit source buttons on pages that do not have a specific source file path set. |
There was a problem hiding this comment.
| The `default_edit_url` and `default_view_url` settings serve as fallback URLs for the view/edit source buttons on pages that do not have a specific source file path set. |
Optional nit; I prefer to avoid starting a sentence with a lower-case letter if possible.
| "feedback": True, | ||
| "github_issues": "enabled", | ||
| "default_source_extension": default_source_extension, | ||
| "default_edit_url": github_repo + "/edit/main/docs/index" + default_source_extension, |
There was a problem hiding this comment.
Just a note, not for this PR necessarily but for eventual implementation into the starter pack, it would be better not to use main here (or anywhere else) and have a variable set somewhere that reflects the branch to use, defaulting to main. Some repos use multiple branches for various versions.
| ### Configure the sitemap | ||
| #### Configure the sitemap | ||
|
|
||
| Add the lastmod setting to the sitemap section: |
There was a problem hiding this comment.
Suggested change
Add the lastmod setting to the sitemap section:
Add the `lastmod` setting to the sitemap section:
Note this has been in the starter pack for a while; maybe add "if it doesn't already exist."
| ## Test the documentation | ||
|
|
||
| Once configuration is complete, review everything again and build it from scratch (cleaning out the existing build files first): | ||
| Once configuration is complete, make sure the required extensions are listed in both the `extensions` list in `conf.py` and the `requirements.txt` file. |
There was a problem hiding this comment.
Might be worth mentioning that extensions bundled with Sphinx (that start with sphinx.ext., such as sphinx.ext.intersphinx) are exceptions; they only need to be listed in conf.py.
This PR clarifies and fixes the guide for testing the Ulwazi theme, addressing some of the issues reported in #580 and #581.
Fixes:
sphinx-terminalto therequirements.txt.sphinx-modern-pdf-stylemust also be added torequirements.txtwhen enabling PDF output.},in thehtml_context"license" block.Improvements:
CHANGELOG.mdwith relevant non-documentation file changes?