diff --git a/doc/conf.py b/doc/conf.py index eb615938..e830713a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -28,9 +28,12 @@ # Controls when a cell will time out (defaults to 30; use -1 for no timeout): #nbsphinx_timeout = 60 -# Default Pygments lexer for syntax highlighting in code cells +# Default Pygments lexer for syntax highlighting in code cells: #nbsphinx_codecell_lexer = 'ipython3' +# Width of input/output prompts used in CSS: +#nbsphinx_prompt_width = '8ex' + # -- The settings below this line are not specific to nbsphinx ------------ master_doc = 'index' diff --git a/nbsphinx.py b/nbsphinx.py index ccff9444..a46a0f92 100644 --- a/nbsphinx.py +++ b/nbsphinx.py @@ -302,7 +302,7 @@ div.nbinput > :first-child[class^=highlight], div.nboutput > :first-child[class^=highlight], div.nboutput > :first-child { - min-width: 11ex; + min-width: %(nbsphinx_prompt_width)s; padding-top: 0.4em; padding-right: 0.4em; text-align: right; @@ -1016,7 +1016,7 @@ def html_page_context(app, pagename, templatename, context, doctree): """Add CSS string to HTML pages that contain code cells.""" style = '' if doctree and doctree.get('nbsphinx_include_css'): - style += CSS_STRING + style += CSS_STRING % app.config if doctree and app.config.html_theme == 'sphinx_rtd_theme': style += CSS_STRING_READTHEDOCS if style: @@ -1168,6 +1168,7 @@ def setup(app): app.add_config_value('nbsphinx_allow_errors', False, rebuild='') app.add_config_value('nbsphinx_timeout', 30, rebuild='') app.add_config_value('nbsphinx_codecell_lexer', 'none', rebuild='env') + app.add_config_value('nbsphinx_prompt_width', '9ex', rebuild='html') app.add_directive('nbinput', NbInput) app.add_directive('nboutput', NbOutput)