Issue #26462: Doc: avoid literal_block warnings, fix syntax highlighting.

Patch by Julien Palard.
diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst
index c1ed15b..5466462 100644
--- a/Doc/library/optparse.rst
+++ b/Doc/library/optparse.rst
@@ -680,7 +680,9 @@
 this option on the command line, it expands your ``version`` string (by
 replacing ``%prog``), prints it to stdout, and exits.
 
-For example, if your script is called ``/usr/bin/foo``::
+For example, if your script is called ``/usr/bin/foo``:
+
+.. code-block:: shell-session
 
    $ /usr/bin/foo --version
    foo 1.0
@@ -730,14 +732,18 @@
 error status 2.
 
 Consider the first example above, where the user passes ``4x`` to an option
-that takes an integer::
+that takes an integer:
+
+.. code-block:: shell-session
 
    $ /usr/bin/foo -n 4x
    Usage: foo [options]
 
    foo: error: option -n: invalid integer value: '4x'
 
-Or, where the user fails to pass a value at all::
+Or, where the user fails to pass a value at all:
+
+.. code-block:: shell-session
 
    $ /usr/bin/foo -n
    Usage: foo [options]