prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  bokeh.palettes refguide page header mis-renders
  Add lots of space, changes font size, for some reason (just this page)
  
  https://docs.bokeh.org/en/latest/docs/reference/palettes.html
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bokeh/sphinxext/bokeh_palette_group.py`
  Content:
  ```
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
  3 # All rights reserved.
  4 #
  5 # The full license is in the file LICENSE.txt, distributed with this software.
  6 #-----------------------------------------------------------------------------
  7 ''' Generate visual representations of palettes in Bokeh palette groups.
  8 
  9 The ``bokeh.palettes`` modules expose attributes such as ``mpl``, ``brewer``,
  10 and ``d3`` that provide groups of palettes. The ``bokeh-palette-group``
  11 directive accepts the name of one of these groups, and generates a visual
  12 matrix of colors for every palette in the group.
  13 
  14 As an example, the following usage of the the directive:
  15 
  16 .. code-block:: rest
  17 
  18     .. bokeh-palette-group:: mpl
  19 
  20 Generates the output:
  21 
  22     .. bokeh-palette-group:: mpl
  23 
  24 '''
  25 
  26 #-----------------------------------------------------------------------------
  27 # Boilerplate
  28 #-----------------------------------------------------------------------------
  29 import logging # isort:skip
  30 log = logging.getLogger(__name__)
  31 
  32 #-----------------------------------------------------------------------------
  33 # Imports
  34 #-----------------------------------------------------------------------------
  35 
  36 # External imports
  37 from docutils import nodes
  38 from docutils.parsers.rst import Directive
  39 from sphinx.errors import SphinxError
  40 
  41 # Bokeh imports
  42 from .. import palettes as bp
  43 from .templates import PALETTE_GROUP_DETAIL
  44 
  45 #-----------------------------------------------------------------------------
  46 # Globals and constants
  47 #-----------------------------------------------------------------------------
  48 
  49 __all__ = (
  50     'bokeh_palette_group',
  51     'BokehPaletteGroupDirective',
  52     'html_visit_bokeh_palette_group',
  53     'setup',
  54 )
  55 
  56 #-----------------------------------------------------------------------------
  57 # General API
  58 #-----------------------------------------------------------------------------
  59 
  60 #-----------------------------------------------------------------------------
  61 # Dev API
  62 #-----------------------------------------------------------------------------
  63 
  64 class bokeh_palette_group(nodes.General, nodes.Element):
  65     pass
  66 
  67 
  68 class BokehPaletteGroupDirective(Directive):
  69 
  70     has_content = False
  71     required_arguments = 1
  72 
  73     def run(self):
  74         node = bokeh_palette_group()
  75         node['group'] = self.arguments[0]
  76         return [node]
  77 
  78 def html_visit_bokeh_palette_group(self, node):
  79     self.body.append(_BOOTSTRAP_CSS)
  80     self.body.append('<div class="container-fluid"><div class="row">"')
  81     group = getattr(bp, node['group'], None)
  82     if not isinstance(group, dict):
  83         raise SphinxError("invalid palette group name %r" % node['group'])
  84     names = sorted(group)
  85     for name in names:
  86         palettes = group[name]
  87         # arbitrary cuttoff here, idea is to not show large (e.g 256 length) palettes
  88         numbers = [x for x in sorted(palettes) if x < 30]
  89         html = PALETTE_GROUP_DETAIL.render(name=name, numbers=numbers, palettes=palettes)
  90         self.body.append(html)
  91     self.body.append('</div></div>')
  92     self.body.append(_BOOTSTRAP_JS)
  93     raise nodes.SkipNode
  94 
  95 def setup(app):
  96     ''' Required Sphinx extension setup function. '''
  97     app.add_node(bokeh_palette_group, html=(html_visit_bokeh_palette_group, None))
  98     app.add_directive('bokeh-palette-group', BokehPaletteGroupDirective)
  99 
  100 #-----------------------------------------------------------------------------
  101 # Private API
  102 #-----------------------------------------------------------------------------
  103 
  104 _BOOTSTRAP_CSS = """
  105 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  106 """
  107 
  108 _BOOTSTRAP_JS = """
  109 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  110 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  111 """
  112 
  113 #-----------------------------------------------------------------------------
  114 # Code
  115 #-----------------------------------------------------------------------------
  116
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bokeh/sphinxext/bokeh_palette_group.py b/bokeh/sphinxext/bokeh_palette_group.py
  --- a/bokeh/sphinxext/bokeh_palette_group.py
  +++ b/bokeh/sphinxext/bokeh_palette_group.py
  @@ -21,6 +21,11 @@
   
       .. bokeh-palette-group:: mpl
   
  +.. note::
  +   This extension assumes both Bootstrap and JQuery are present (which is the
  +   case for the Bokeh documentation theme). If using this theme outside the
  +   Bokeh documentation, be sure to include those resources by hand.
  +
   '''
   
   #-----------------------------------------------------------------------------
  @@ -75,8 +80,9 @@
           node['group'] = self.arguments[0]
           return [node]
   
  +# NOTE: This extension now *assumes* both Bootstrap and JQuery are present
  +# (which is now the case for the Bokeh docs theme).
   def html_visit_bokeh_palette_group(self, node):
  -    self.body.append(_BOOTSTRAP_CSS)
       self.body.append('<div class="container-fluid"><div class="row">"')
       group = getattr(bp, node['group'], None)
       if not isinstance(group, dict):
  @@ -89,7 +95,6 @@
           html = PALETTE_GROUP_DETAIL.render(name=name, numbers=numbers, palettes=palettes)
           self.body.append(html)
       self.body.append('</div></div>')
  -    self.body.append(_BOOTSTRAP_JS)
       raise nodes.SkipNode
   
   def setup(app):
  @@ -101,15 +106,6 @@
   # Private API
   #-----------------------------------------------------------------------------
   
  -_BOOTSTRAP_CSS = """
  -<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  -"""
  -
  -_BOOTSTRAP_JS = """
  -<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  -<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  -"""
  -
   #-----------------------------------------------------------------------------
   # Code
   #-----------------------------------------------------------------------------
  
verification_info: {"golden_diff": "diff --git a/bokeh/sphinxext/bokeh_palette_group.py b/bokeh/sphinxext/bokeh_palette_group.py\n--- a/bokeh/sphinxext/bokeh_palette_group.py\n+++ b/bokeh/sphinxext/bokeh_palette_group.py\n@@ -21,6 +21,11 @@\n \n     .. bokeh-palette-group:: mpl\n \n+.. note::\n+   This extension assumes both Bootstrap and JQuery are present (which is the\n+   case for the Bokeh documentation theme). If using this theme outside the\n+   Bokeh documentation, be sure to include those resources by hand.\n+\n '''\n \n #-----------------------------------------------------------------------------\n@@ -75,8 +80,9 @@\n         node['group'] = self.arguments[0]\n         return [node]\n \n+# NOTE: This extension now *assumes* both Bootstrap and JQuery are present\n+# (which is now the case for the Bokeh docs theme).\n def html_visit_bokeh_palette_group(self, node):\n-    self.body.append(_BOOTSTRAP_CSS)\n     self.body.append('<div class=\"container-fluid\"><div class=\"row\">\"')\n     group = getattr(bp, node['group'], None)\n     if not isinstance(group, dict):\n@@ -89,7 +95,6 @@\n         html = PALETTE_GROUP_DETAIL.render(name=name, numbers=numbers, palettes=palettes)\n         self.body.append(html)\n     self.body.append('</div></div>')\n-    self.body.append(_BOOTSTRAP_JS)\n     raise nodes.SkipNode\n \n def setup(app):\n@@ -101,15 +106,6 @@\n # Private API\n #-----------------------------------------------------------------------------\n \n-_BOOTSTRAP_CSS = \"\"\"\n-<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">\n-\"\"\"\n-\n-_BOOTSTRAP_JS = \"\"\"\n-<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>\n-<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>\n-\"\"\"\n-\n #-----------------------------------------------------------------------------\n # Code\n #-----------------------------------------------------------------------------\n", "issue": "bokeh.palettes refguide page header mis-renders\nAdd lots of space, changes font size, for some reason (just this page)\r\n\r\nhttps://docs.bokeh.org/en/latest/docs/reference/palettes.html\r\n\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.\n# All rights reserved.\n#\n# The full license is in the file LICENSE.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n''' Generate visual representations of palettes in Bokeh palette groups.\n\nThe ``bokeh.palettes`` modules expose attributes such as ``mpl``, ``brewer``,\nand ``d3`` that provide groups of palettes. The ``bokeh-palette-group``\ndirective accepts the name of one of these groups, and generates a visual\nmatrix of colors for every palette in the group.\n\nAs an example, the following usage of the the directive:\n\n.. code-block:: rest\n\n    .. bokeh-palette-group:: mpl\n\nGenerates the output:\n\n    .. bokeh-palette-group:: mpl\n\n'''\n\n#-----------------------------------------------------------------------------\n# Boilerplate\n#-----------------------------------------------------------------------------\nimport logging # isort:skip\nlog = logging.getLogger(__name__)\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# External imports\nfrom docutils import nodes\nfrom docutils.parsers.rst import Directive\nfrom sphinx.errors import SphinxError\n\n# Bokeh imports\nfrom .. import palettes as bp\nfrom .templates import PALETTE_GROUP_DETAIL\n\n#-----------------------------------------------------------------------------\n# Globals and constants\n#-----------------------------------------------------------------------------\n\n__all__ = (\n    'bokeh_palette_group',\n    'BokehPaletteGroupDirective',\n    'html_visit_bokeh_palette_group',\n    'setup',\n)\n\n#-----------------------------------------------------------------------------\n# General API\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Dev API\n#-----------------------------------------------------------------------------\n\nclass bokeh_palette_group(nodes.General, nodes.Element):\n    pass\n\n\nclass BokehPaletteGroupDirective(Directive):\n\n    has_content = False\n    required_arguments = 1\n\n    def run(self):\n        node = bokeh_palette_group()\n        node['group'] = self.arguments[0]\n        return [node]\n\ndef html_visit_bokeh_palette_group(self, node):\n    self.body.append(_BOOTSTRAP_CSS)\n    self.body.append('<div class=\"container-fluid\"><div class=\"row\">\"')\n    group = getattr(bp, node['group'], None)\n    if not isinstance(group, dict):\n        raise SphinxError(\"invalid palette group name %r\" % node['group'])\n    names = sorted(group)\n    for name in names:\n        palettes = group[name]\n        # arbitrary cuttoff here, idea is to not show large (e.g 256 length) palettes\n        numbers = [x for x in sorted(palettes) if x < 30]\n        html = PALETTE_GROUP_DETAIL.render(name=name, numbers=numbers, palettes=palettes)\n        self.body.append(html)\n    self.body.append('</div></div>')\n    self.body.append(_BOOTSTRAP_JS)\n    raise nodes.SkipNode\n\ndef setup(app):\n    ''' Required Sphinx extension setup function. '''\n    app.add_node(bokeh_palette_group, html=(html_visit_bokeh_palette_group, None))\n    app.add_directive('bokeh-palette-group', BokehPaletteGroupDirective)\n\n#-----------------------------------------------------------------------------\n# Private API\n#-----------------------------------------------------------------------------\n\n_BOOTSTRAP_CSS = \"\"\"\n<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\">\n\"\"\"\n\n_BOOTSTRAP_JS = \"\"\"\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>\n<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js\"></script>\n\"\"\"\n\n#-----------------------------------------------------------------------------\n# Code\n#-----------------------------------------------------------------------------\n", "path": "bokeh/sphinxext/bokeh_palette_group.py"}], "after_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.\n# All rights reserved.\n#\n# The full license is in the file LICENSE.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n''' Generate visual representations of palettes in Bokeh palette groups.\n\nThe ``bokeh.palettes`` modules expose attributes such as ``mpl``, ``brewer``,\nand ``d3`` that provide groups of palettes. The ``bokeh-palette-group``\ndirective accepts the name of one of these groups, and generates a visual\nmatrix of colors for every palette in the group.\n\nAs an example, the following usage of the the directive:\n\n.. code-block:: rest\n\n    .. bokeh-palette-group:: mpl\n\nGenerates the output:\n\n    .. bokeh-palette-group:: mpl\n\n.. note::\n   This extension assumes both Bootstrap and JQuery are present (which is the\n   case for the Bokeh documentation theme). If using this theme outside the\n   Bokeh documentation, be sure to include those resources by hand.\n\n'''\n\n#-----------------------------------------------------------------------------\n# Boilerplate\n#-----------------------------------------------------------------------------\nimport logging # isort:skip\nlog = logging.getLogger(__name__)\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# External imports\nfrom docutils import nodes\nfrom docutils.parsers.rst import Directive\nfrom sphinx.errors import SphinxError\n\n# Bokeh imports\nfrom .. import palettes as bp\nfrom .templates import PALETTE_GROUP_DETAIL\n\n#-----------------------------------------------------------------------------\n# Globals and constants\n#-----------------------------------------------------------------------------\n\n__all__ = (\n    'bokeh_palette_group',\n    'BokehPaletteGroupDirective',\n    'html_visit_bokeh_palette_group',\n    'setup',\n)\n\n#-----------------------------------------------------------------------------\n# General API\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Dev API\n#-----------------------------------------------------------------------------\n\nclass bokeh_palette_group(nodes.General, nodes.Element):\n    pass\n\n\nclass BokehPaletteGroupDirective(Directive):\n\n    has_content = False\n    required_arguments = 1\n\n    def run(self):\n        node = bokeh_palette_group()\n        node['group'] = self.arguments[0]\n        return [node]\n\n# NOTE: This extension now *assumes* both Bootstrap and JQuery are present\n# (which is now the case for the Bokeh docs theme).\ndef html_visit_bokeh_palette_group(self, node):\n    self.body.append('<div class=\"container-fluid\"><div class=\"row\">\"')\n    group = getattr(bp, node['group'], None)\n    if not isinstance(group, dict):\n        raise SphinxError(\"invalid palette group name %r\" % node['group'])\n    names = sorted(group)\n    for name in names:\n        palettes = group[name]\n        # arbitrary cuttoff here, idea is to not show large (e.g 256 length) palettes\n        numbers = [x for x in sorted(palettes) if x < 30]\n        html = PALETTE_GROUP_DETAIL.render(name=name, numbers=numbers, palettes=palettes)\n        self.body.append(html)\n    self.body.append('</div></div>')\n    raise nodes.SkipNode\n\ndef setup(app):\n    ''' Required Sphinx extension setup function. '''\n    app.add_node(bokeh_palette_group, html=(html_visit_bokeh_palette_group, None))\n    app.add_directive('bokeh-palette-group', BokehPaletteGroupDirective)\n\n#-----------------------------------------------------------------------------\n# Private API\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Code\n#-----------------------------------------------------------------------------\n", "path": "bokeh/sphinxext/bokeh_palette_group.py"}]}