remotecode is an extension for Sphinx that enables code blocks from remote sources.


  1. Install chios, then add remotecode to the list of extensions in

    extensions = ['chios.remotecode']
  2. Use the remote-code-block directive to fetch remote source code and display it in a code-block.

    .. remote-code-block:: ini


If a remote-code-block is empty in the HTML output, it is likely that the given link could not be resolved. Check the Sphinx build messages for a warning:

index.rst:32: WARNING: Unable to resolve https://example.ini

Code listing

A Sphinx extension that enables code blocks from remote sources.

Copyright (C) 2021 Brian Moss

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.

class remotecode.RemoteCodeBlock(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Create remote-code-block directive.


Fetch remote code.

remotecode.setup(app) dict[source]

Set up Sphinx extension.


app – Sphinx application context.