collective / sphinxcontrib-httpexample

Adds example directive for sphinx-contrib httpdomain
23 stars 20 forks source link

Compatibility with Sphinx v4 #59

Closed AWhetter closed 3 years ago

AWhetter commented 3 years ago

When using this extension with Sphinx v4, and ImportError occurs as follows:

...
File ".../site-packages/sphinxcontrib/httpexample/directives.py", line 5, in <module>
  from sphinx.directives  import CodeBlock
ImportError: cannot import name 'CodeBlock' from 'sphinx.directives' (unknown location)

Sphinx v2 deprecated the sphinx.directives.CodeBlock in favour of sphinx.directives.code.CodeBlock, and Sphinx v4 removed it (https://www.sphinx-doc.org/en/master/extdev/deprecated.html?highlight=CodeBlock). The extension needs to use the new location instead.