]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117225: Document colour use in `doctest` (#118268)
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Wed, 1 May 2024 18:25:11 +0000 (21:25 +0300)
committerGitHub <noreply@github.com>
Wed, 1 May 2024 18:25:11 +0000 (12:25 -0600)
Doc/using/cmdline.rst
Doc/whatsnew/3.13.rst

index 295e3fb09830ce3668e8f519be9c2dab02263b0f..1f5d02d1ea54a231e17134abc9bfa684a6c1821a 100644 (file)
@@ -632,11 +632,11 @@ behavior can be controlled by setting different environment variables.
 
 Setting the environment variable ``TERM`` to ``dumb`` will disable color.
 
-If the environment variable ``FORCE_COLOR`` is set, then color will be
+If the |FORCE_COLOR|_ environment variable is set, then color will be
 enabled regardless of the value of TERM. This is useful on CI systems which
 aren’t terminals but can still display ANSI escape sequences.
 
-If the environment variable ``NO_COLOR`` is set, Python will disable all color
+If the |NO_COLOR|_ environment variable is set, Python will disable all color
 in the output. This takes precedence over ``FORCE_COLOR``.
 
 All these environment variables are used also by other tools to control color
@@ -645,6 +645,14 @@ output. To control the color output only in the Python interpreter, the
 precedence over ``NO_COLOR``, which in turn takes precedence over
 ``FORCE_COLOR``.
 
+.. Apparently this how you hack together a formatted link:
+
+.. |FORCE_COLOR| replace:: ``FORCE_COLOR``
+.. _FORCE_COLOR: https://force-color.org/
+
+.. |NO_COLOR| replace:: ``NO_COLOR``
+.. _NO_COLOR: https://no-color.org/
+
 Options you shouldn't use
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
index 5a169556066421abe7aabaff90c72c8a5674a01a..d67df8109a8ced383379f21776269e106c936c51 100644 (file)
@@ -100,10 +100,18 @@ Improved Error Messages
 
 * The interpreter now colorizes error messages when displaying tracebacks by default.
   This feature can be controlled via the new :envvar:`PYTHON_COLORS` environment
-  variable as well as the canonical ``NO_COLOR`` and ``FORCE_COLOR`` environment
+  variable as well as the canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment
   variables. See also :ref:`using-on-controlling-color`.
   (Contributed by Pablo Galindo Salgado in :gh:`112730`.)
 
+.. Apparently this how you hack together a formatted link:
+
+.. |FORCE_COLOR| replace:: ``FORCE_COLOR``
+.. _FORCE_COLOR: https://force-color.org/
+
+.. |NO_COLOR| replace:: ``NO_COLOR``
+.. _NO_COLOR: https://no-color.org/
+
 * A common mistake is to write a script with the same name as a
   standard library module. When this results in errors, we now
   display a more helpful error message:
@@ -439,6 +447,12 @@ doctest
   :attr:`doctest.TestResults.skipped` attributes.
   (Contributed by Victor Stinner in :gh:`108794`.)
 
+* Color is added to the output by default.
+  This can be controlled via the new :envvar:`PYTHON_COLORS` environment
+  variable as well as the canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment
+  variables. See also :ref:`using-on-controlling-color`.
+  (Contributed by Hugo van Kemenade in :gh:`117225`.)
+
 email
 -----