Browse Source

Fix syntac highlighting in docs

shalvah 5 years ago
parent
commit
103b6894b7
1 changed files with 11 additions and 2 deletions
  1. 11 2
      docs/conf.py

+ 11 - 2
docs/conf.py

@@ -42,8 +42,6 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
 
 # -- Options for HTML output -------------------------------------------------
 
-pygments_style = 'sphinx'
-
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
@@ -63,3 +61,14 @@ def setup(app):
         'enable_eval_rst': True,
     }, True)
     app.add_transform(AutoStructify)
+
+# Syntax highlighting
+pygments_style = 'sphinx'
+
+# adding PhpLexer
+from sphinx.highlighting import lexers
+from pygments.lexers.web import PhpLexer
+
+# enable highlighting for PHP code not between ``<?php ... ?>`` by default
+lexers['php'] = PhpLexer(startinline=True)
+lexers['php-annotations'] = PhpLexer(startinline=True)