Skip to content

docs: improve syntax guides - #19

Open
asanvaq wants to merge 8 commits into
canonical:mainfrom
asanvaq:main
Open

asanvaq wants to merge 8 commits into
canonical:mainfrom
asanvaq:main

Conversation

@asanvaq

@asanvaq asanvaq commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Addresses #7

There is some confusion about the purpose of the currently included MD and rST "style guide" documents. This PR amalgamates them and converts them syntax reference documents, removing style guidelines.

Tabs and tables are used depending on the length of the reST or MyST syntax.

The image example was updated to include an image in the repository to shorten the syntax examples. This way, it all fits in a table.

I also included links to the intersphinx guide and updated the terminology of cross references to only use "labels", following Cross-references — Sphinx documentation.

AI disclosure: Claude Sonnet 4.6 was used to format tables and to initially combine both syntax guides. Content was checked, updated and arranged manually after that.

  • Have you updated CHANGELOG.md with relevant non-documentation file changes?
  • Have you updated the documentation for this change?

@asanvaq
asanvaq marked this pull request as ready for review July 27, 2026 12:53

@jahn-junior jahn-junior left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all of your work on this! I left a bunch of comments on things that jumped out at me, but I admit that I didn't scan through this line-by-line.

My biggest concern is that, while a single page is nice, we're now pushing the limit of what is maintainable by humans. Even the rendered page is a bit hard to parse with the onscreen elements and nesting. Maintenance aside, I think that users are more likely to be looking for syntax in one markup language or the other, which may outweigh the benefits of putting them side-by-side. I don't have a concrete request on this front, but I think it's something we should consider.

Comment thread docs/reference/syntax.md
@@ -0,0 +1,1520 @@
---
relatedlinks: https://github.com/canonical/canonical-sphinx-extensions, https://github.com/canonical/lxd-sphinx-extensions, [reStructuredText Primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html), [Canonical Documentation Style Guide](https://docs.ubuntu.com/styleguide/en)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relatedlinks: https://github.com/canonical/canonical-sphinx-extensions, https://github.com/canonical/lxd-sphinx-extensions, [reStructuredText Primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html), [Canonical Documentation Style Guide](https://docs.ubuntu.com/styleguide/en)
relatedlinks: https://github.com/canonical/canonical-sphinx, [reStructuredText Primer](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html), [Canonical Documentation Style Guide](https://docs.ubuntu.com/styleguide/en)
  • I assume the first link was meant to be the canonical-sphinx theme
  • canonical-sphinx-extensions was superseded by the standalone extension repositories.

Comment thread docs/reference/syntax.md
# Syntax guide

The Sphinx Stack supports [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html) (reST), [Markdown](https://commonmark.org/) and
[MyST](https://myst-parser.readthedocs.io/).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[MyST](https://myst-parser.readthedocs.io/).
The Sphinx Stack supports [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html) (reST) and [MyST Markdown](https://myst-parser.readthedocs.io/).

MyST is a superset of Commonmark, so we probably don't need to explicitly mention Commonmark support.

Comment thread docs/reference/syntax.md

* - Description
- <span style="text-transform: none">reST</span>
- <span style="text-transform: none">MyST</span>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- <span style="text-transform: none">MyST</span>
- reST
- MyST

Comment thread docs/reference/syntax.md
`````{tab-item} reST
To start a code block, either end the introductory paragraph with two colons (``::``)
and indent the following code block, or explicitly start a code block with ``..
code::``. In both cases, the code block must be surrounded by empty lines.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is meant to be less opinionated when it comes to style, but I think we should still promote a consistent use of reST and MyST syntax where possible.

For instance, I don't think we should bring extra attention to the :: code block syntax, as it isn't declarative and is even less visually accessible than the rest of reST syntax.

Comment thread docs/reference/syntax.md
Or use the explicit directive:

````
.. code::

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're assuming that the project is based on the Sphinx Stack, can we advise users to use the code-block directive instead? It has a much more robust set of options. The code directive is the more barebones version provided by Docutils.

Comment thread docs/reference/syntax.md

* - Output
- <span style="text-transform: none">reST</span>
- <span style="text-transform: none">MyST</span>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- <span style="text-transform: none">MyST</span>
- reST
- MyST

I won't duplicate this suggestion, but it's in all of these tables.

Comment thread docs/reference/syntax.md
* - Output
- <span style="text-transform: none">reST</span>
- <span style="text-transform: none">MyST</span>
* - <ol><li>Step 1<ul><li>Item 1<ul><li>Sub-item</li></ul></li><li>Item 2</li></ul></li><li>Step 2<ol><li>Sub-step 1</li><li>Sub-step 2</li></ol></li></ol>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like another translation error? There are a few other instances of stuff like this the subsequent tables as well.

Comment thread docs/reference/syntax.md
## Notes

```{list-table}
:header-rows: 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should bring attention to the standard admonition's args and options, as it's the one that should probably be used most often.

.. admonition:: <title>
    :class: <class>

Comment thread docs/reference/syntax.md

`````{tab-item} reST
**Globally**, in a file named ``reuse/substitutions.txt`` that is included in a
custom ``rst_epilog`` directive (see the [rst_epilog documentation](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_epilog)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've removed this from the Sphinx Stack as well.

Comment thread docs/reference/syntax.md
Comment on lines +1297 to +1300
Please note:

- Substitutions do not work on GitHub. Therefore, use substitution names that indicate
the included content (for example, `note_not_supported` instead of `reuse_note`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Please note:
- Substitutions do not work on GitHub. Therefore, use substitution names that indicate
the included content (for example, `note_not_supported` instead of `reuse_note`).
Substitutions do not work on GitHub. Therefore, use substitution names that indicate the included content (for example, `note_not_supported` instead of `reuse_note`).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants