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

Jeo*_*hum 6 diff restructuredtext highlight

我试图寻找但失败了。

我认为将以“+”开头的线条着色为红色

...以及将以“-”开头的线条着色为蓝色

...就足够了。

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
Run Code Online (Sandbox Code Playgroud)

sin*_*roc 8

您可能应该使用该code-block指令并使用Pygmentdiff词法分析器。你的*.rst文件可能应该是这样的:

.. code-block:: diff

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