diff --git a/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
index b96018a4edcf..2993eda49439 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -27,7 +27,9 @@ and unpacking the files is often optionally followed by patching.
 Patching, however, is not covered by this module.
 
 The code to execute the first part of this process, a fetch, looks
-something like the following::
+something like the following:
+
+.. code-block:: python
 
    src_uri = (d.getVar('SRC_URI') or "").split()
    fetcher = bb.fetch2.Fetch(src_uri, d)
@@ -37,7 +39,9 @@ This code sets up an instance of the fetch class. The instance uses a
 space-separated list of URLs from the :term:`SRC_URI`
 variable and then calls the ``download`` method to download the files.
 
-The instantiation of the fetch class is usually followed by::
+The instantiation of the fetch class is usually followed by:
+
+.. code-block:: python
 
    rootdir = l.getVar('UNPACKDIR')
    fetcher.unpack(rootdir)
@@ -203,7 +207,9 @@ that updates an existing checkout *in place* rather than removing and
 re-cloning it. This is useful when the target directory may contain
 local commits that should be preserved across updates.
 
-The code to call the non-destructive update looks like the following::
+The code to call the non-destructive update looks like the following:
+
+.. code-block:: python
 
    rootdir = l.getVar('UNPACKDIR')
    fetcher.unpack_update(rootdir)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst b/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
index 09e353945bb6..8c9d9003dd7b 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
@@ -29,7 +29,9 @@ Formatted string can also be used directly::
 
    bb.error("%s, we have a %s" % ("Houston", "big problem"))
 
-Python f-strings may also be used::
+Python f-strings may also be used:
+
+.. code-block:: python
 
    h = "Houston"
    bb.fatal(f"{h}, we have a critical problem")
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index b0535b5dd459..a146b897c884 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -1719,7 +1719,9 @@ environment into a special variable named :term:`BB_ORIGENV`.
 The :term:`BB_ORIGENV` variable returns a datastore object that can be
 queried using the standard datastore operators such as
 ``getVar(, False)``. The datastore object is useful, for example, to
-find the original ``DISPLAY`` variable. Here is an example::
+find the original ``DISPLAY`` variable. Here is an example:
+
+.. code-block:: python
 
    origenv = d.getVar("BB_ORIGENV", False)
    bar = origenv.getVar("BAR", False)
@@ -1732,7 +1734,9 @@ Variable Flags
 
 Variable flags (varflags) help control a task's functionality and
 dependencies. BitBake reads and writes varflags to the datastore using
-the following command forms::
+the following command forms:
+
+.. code-block:: python
 
    variable = d.getVarFlags("variable")
    self.d.setVarFlags("FOO", {"func": True})
