Index: __init__.py
===================================================================
--- __init__.py	(revision 2367)
+++ __init__.py	(working copy)
@@ -60,6 +60,16 @@
         to override the default quality ratio used by the
         Pygments render.""")
 
+    pygments_options = ListOption('mimeviewer', 'pygments_options',
+        '', doc=
+        """List of options to be passed to lexers.
+
+        For each, a tuple `mode:option` has to be specified,
+        for example `php:startinline=1`.  To specify more than
+        one option, simply repeat the mode in the style,
+        `php:a=1,php:b=2`
+        """)
+
     expand_tabs = True
     returns_source = True
 
@@ -218,9 +228,23 @@
                     Mimeview(self.env).configured_modes_mapping('pygments')
                 )
 
+        self._options = {}
+        for t, opt in [x.split(':', 1) for x in self.pygments_options]:
+            opts = self._options.get(t)
+            if not opts:
+                opts = {}
+                self._options[t] = opts
+            key, value = opt.split('=', 1)
+            opts[str(key)] = value
+
+
     def _highlight(self, language, content, annotate):
+        self.log.debug("Pygments renderering for language=%s" % language)
         formatter = HtmlFormatter(cssclass=not annotate and 'code' or '')
-        html = pygments.highlight(content, get_lexer_by_name(language),
+        opts = self._options.get(language, {})
+        opts['stripnl'] = False
+        lexer = get_lexer_by_name(language, **opts)
+        html = pygments.highlight(content, lexer,
                                   formatter).rstrip('\n')
         if annotate:
             return html[len('<div><pre>'):-len('</pre></div>')].splitlines()

