Python-Sphinx documentation: link source code
<p>I have a dictionary that represent a schema (JSON-Schema to be more precise).</p>

<p>Sometimes the schema gets complex and in the documentation I need to link to it in order to give a better picture.</p>

<p>I have the <code>viewcode</code> extension enabled, I tried the following with no luck:</p>

<pre><code>.. data:: netjsonconfig.backends.openvpn.schema.schema

.. automodule:: netjsonconfig.backends.openvpn.schema
</code></pre>

<p>The dictionary python path is <code>netjsonconfig.backends.openvpn.schema.schema</code>.</p>

<p>Is it possible to achieve this? If yes how?</p>

<p>Try this:</p>

<pre><code>.. literalinclude:: your_json_filename.json
    :language: json
</code></pre>

<p>You can even select a part of this file to display by </p>

<pre><code>.. literalinclude:: your_json_filename.json
    :language: json
    :lines: 18-43
</code></pre>

<p>This displays the lines 18 to 43 of <em>your_json_filename.json</em>.</p>

python python-sphinx