canonical/open-documentation-academy

Ubuntu Core docs: Revise code blocks

开放

#344 创建于 2026年6月15日

 (6 条评论) (0 个反应) (0 位负责人)Python (99 个派生)auto 404
codeeditgood first issuesize 3

仓库指标

星标
 (119 个星标)
PR 合并指标
 (平均合并 6天 22小时) (30 天内合并 2 个 PR)

描述

Situation

The Ubuntu Core docs have code blocks that don't follow the best practices, which impacts the reader's experience, such as the result when they copy a code block. It also impacts the writer's experience, in that the document sources are inconsistent and more difficult to read.

Request

We would like to revise every code block in the docs. This task involves fine-tuning the source for the documents, and searching through the files.

The general approach would be:

  1. Remove all prompt markers ($).
  2. For each command, assess the suitability of the output text and remove it if it adds no value. If the command prints the default result, or shows the user only predictable and easy-to-anticipate text, then it adds no value. An example of predictable text would be: if the command were snap remove <snap>, the predictable output would be Removed <snap>.
  3. Set the language for all blocks to bash.

When searching the repository, there are a few patterns you should look for that produce code blocks:

Here's an example of a good existing code block in the docs:

https://github.com/canonical/ubuntu-core-docs/blob/main/docs/explanation/refresh-control.md?plain=1#L251-L253

贡献者指南