如何在 sphinx 的重组文本中突出显示差异输出文本?

How can I highlight diff output text in restructuredtext in sphinx?

我试图找到但失败了。

我认为以“+”开头的行用红色着色

...并将以“-”开头的行着色为蓝色

...就够了。

hello.c::

    +#else                                 <<<<< want this line in red
     ISR_RESULT ISRs(U32 Interrupt, U32 Vector)
    +#endif                                <<<<< want this line in red
     {
    -//     printf ("Get IRQs \r\n");      <<<<< want this line in blue
    -       switch (Interrupt)             <<<<< want this line in blue
    -       {                              <<<<< want this line in blue
    -         case ISR_MBOX0:              <<<<< want this line in blue

您可能应该使用 code-block directive and use Pygment's diff lexer。您的 *.rst 文件可能应该如下所示:

.. code-block:: diff

    +#else
     ISR_RESULT ISRs(U32 Interrupt, U32 Vector)
    +#endif
     {
    -//     printf ("Get IRQs \r\n");
    -       switch (Interrupt)
    -       {
    -         case ISR_MBOX0: