Skip to content

Commit

Permalink
docs: highlight all code snippets
Browse files Browse the repository at this point in the history
Unfortunately, Sphinx doesn't support code highlighting for standard
reStructuredText `code` directive. So let's register 'code' directive
as alias for Sphinx's own implementation.

See sphinx-doc/sphinx#2155 for details.
  • Loading branch information
Igor Kalnitsky committed Jan 12, 2016
1 parent 230384c commit 276ed68
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@
# html settings
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']


# Unfortunately, Sphinx doesn't support code highlighting for standard
# reStructuredText `code` directive. So let's register 'code' directive
# as alias for Sphinx's own implementation.
#
# https://github.com/sphinx-doc/sphinx/issues/2155
from docutils.parsers.rst import directives
from sphinx.directives.code import CodeBlock
directives.register_directive('code', CodeBlock)

0 comments on commit 276ed68

Please sign in to comment.