瀏覽代碼

Fix syntac highlighting in docs

shalvah 5 年之前
父節點
當前提交
103b6894b7
共有 1 個文件被更改,包括 11 次插入2 次删除
  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)