Skip to content

Replace code directive by the sphinx code-block#1714

Draft
parulin wants to merge 1 commit into
QubesOS:mainfrom
parulin:code-to-code-block
Draft

Replace code directive by the sphinx code-block#1714
parulin wants to merge 1 commit into
QubesOS:mainfrom
parulin:code-to-code-block

Conversation

@parulin

@parulin parulin commented May 20, 2026

Copy link
Copy Markdown
Contributor

The code:: directive is a directive compatible with docutils, allowing less options than the code-block:: or sourcecode:: Sphinx directives.

See this comment: sphinx-doc/sphinx#14411 (comment)

This PR replaces code:: by code-block:: everywhere. Another option is to change only the documentation style guide and the how-to, I'm fine with both.

@unman unman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am somewhat opposed to global changes like this. The results are difficult to review.
In this case I'd like to FIRST discuss the potential benefits to users and THEN move to implement if agreed.
What are the concrete advantages to users of this global change?

@parulin

parulin commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

I was lazy, tried to batch replace everything to see if it worked and getting no warning, I made this PR. Now, I'm reconsidering it and the few advantages I can find are limited.

I still think it would be good to favor code-block in the rst how-to and style guide, because some options don't work with code (i.e.: the examples of :linenos: and :emphasize-lines: are not functional). To me the main advantage is the emphasize-lines option. There are other options but I'm not sure they are helpful. There is no need to replace the code directive by the code-block one in the other parts of the documentation.

We can also remove the mention to emphasize-lines and correct the linenos example to work with code directive.

What do you think?

@parulin parulin marked this pull request as draft May 20, 2026 18:33
@unman

unman commented May 21, 2026 via email

Copy link
Copy Markdown
Member

@parulin

parulin commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

There are currently two different PRs on the Sphinx side: one keeping things as they are but changing the docs, the other one making code a real alias for code-block. So making such a global change in qubes-doc is obviously wrong right now.

I don't think we can expect them to be shipped in a new Sphinx version very soon, so I would like to just fix the 2 examples where the code directive is wrong in the meantime. That would be a very small PR. Is that okay?

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.

2 participants