2017-08-04 3 views
0

私は、最初のファイルに次き:今、私はそのコードでpytest_tb.json単語にハイパーリンクを置けばいいのか可能であれば、最初のファイルのコードセクションにハイパーリンクを挿入するにはどうすればよいですか?

.. code-block:: bash 

    [email protected]:~/workspace$ pytest 
    test/test/functional/example/test_api_2.py 
    --testbed test/test/topo_confs/pytest_tb.json 
    --loglevel DEBUG --html /home/user/test.html --self-contained-html 

答えて

0

.. code-block::は、リテラルコードに対してのみ構文強調を適用します。つまり、reStructuredTextマークアップを解釈してハイパーリンクをサポートしません。

代わりに、あなたのSphinxテーマのCSSファイルでカスタムスタイルを使用することができます。名前はmy-code-blockとし、次のようなreSTマークアップを使用します。あなたのCSSファイルで

:Pygmentsからの強調表示bashの構文は適用されません

.. rst-class:: my-code-block 

    [email protected]:~/workspace$ pytest 
    test/test/functional/example/test_api_2.py 
    --testbed test/test/topo_confs/`pytest_tb.json <relative/path/to/pytest_tb.json>`_ 
    --loglevel DEBUG --html /home/user/test.html --self-contained-html 

注:

p.my-code-block { 
    font-family: monospace; 
    white-space: pre; 
} 

そして、あなたのreSTソースファイルで

。しかし、HTML出力ではJavaScriptの構文ハイライトを使用する方が気になるかもしれませんが、JavaScriptの必要条件やテーマの更新に合わせてHTML出力を取得することは、それが価値があるよりも困難で難題になります。

関連する問題