# [IPython-User] Change Notebook CSS?

MinRK benjaminrk@gmail....
Wed Aug 29 16:41:23 CDT 2012

On Wed, Aug 29, 2012 at 2:25 PM, G B <g.c.b.at.work@gmail.com> wrote:

> Excellent!  I went with the tarball option, and after fiddling a bit
> realized I needed to move aside the eggs left behind by the Superpack.
>  After that, I now have an italic h3.
>
> Thanks for the handholding on this-- I'm a step closer to my dream of live
> documentation.
>
>
> What other customizations can be put into the static directory--
> javascript?  Or is this css only?
>

You can override literally everything in the static dir (js or css).  CSS
is obviously a lot less hazardous than js, so do that at your own risk,
but for instance you can use this to install local mathjax, or test out a
newer release of CodeMirror or jQuery without touching the IPython install.

>
> In an attempt to check for myself, I did a 'ipython profile create foo'
> from the command line, and the generated profile_foo directory does not
> contain a 'static' subdirectory.  An earlier comment suggested that there
> should be one.  Is there still a remnant of the old install interfering?
>

No, my comment was unclear.  I only meant to imply that custom.css should
never return a 404, because it exists, regardless of whether you create

Creating a profile does not create a static dir.

>
>
>
> On Mon, Aug 27, 2012 at 4:02 PM, MinRK <benjaminrk@gmail.com> wrote:
>
>>
>>
>> On Mon, Aug 27, 2012 at 3:52 PM, G B <g.c.b.at.work@gmail.com> wrote:
>>
>>> Interesting-- I had to create the static directory in my profile, so I'm
>>> probably not using master.  I think I installed this from here:
>>> http://fonnesbeck.github.com/ScipySuperpack/
>>> though, sadly, I might be remembering that wrong.  It was a weekend of
>>> great frustration as I updated to Mountain Lion and then rebuilt a
>>> gazillion tools I use daily.  If I remember correctly, that installer made
>>> my life very much more pleasant-- but I'd long since forsaken careful
>>> documentation of my installation procedures in favor of flailing madly to
>>> get the *#^\$ thing working again.
>>>
>>>
>> Superpack is great, but it's everything up to date *as of the superpack
>> build*, and the custom js/css was introduced since the one you installed.
>>
>>
>>> Anyway, leaving the epic tales to the minstrels and returning to the
>>> point:
>>> import IPython; print IPython.sys_info() returns:
>>>
>>> {'commit_hash': '6ed621a',
>>>  'commit_source': 'installation',
>>>  'default_encoding': 'UTF-8',
>>>  'ipython_path': '/Library/Python/2.7/site-packages/ipython-0.14.dev-py2.7.egg/IPython',
>>>  'ipython_version': '0.14.dev',
>>>  'os_name': 'posix',
>>>  'platform': 'Darwin-12.1.0-x86_64-i386-64bit',
>>>  'sys_executable': '/usr/bin/python',
>>>  'sys_platform': 'darwin',
>>>  'sys_version': '2.7.2 (default, Jun 20 2012, 16:23:33) \n[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]'}
>>>
>>>
>> That's too old. You can update to current IPython master with:
>>
>> pip install https://github.com/ipython/ipython/tarball/master
>>
>> or to stay up to date:
>>
>> git clone git://github.com/ipython/ipython
>> cd ipython
>> python setupegg.py develop
>>
>>
>> Then just git pull in the ipython dir when you want to update.
>>
>>
>>>
>>>
>>>
>>> (Taking a tangent again: I guess I've been over conditioned by exposure to Apple on the iPython vs IPython spellings.  My fingers have been quite stubborn about demoting the case of the leading 'I', forcing me to always have to re-edit the cell every time I type "import iPython".  You'd think the pain would force a change in behavior, but...)
>>>
>>>
>>>
>>>
>>> On Mon, Aug 27, 2012 at 3:27 PM, MinRK <benjaminrk@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Mon, Aug 27, 2012 at 3:02 PM, G B <g.c.b.at.work@gmail.com> wrote:
>>>>
>>>>> Back at it after the weekend...
>>>>>
>>>>> http://127.0.0.1:8888/static/css/custom.css
>>>>>
>>>>>
>>>> What do you get from import IPython; print IPython.sys_info()?
>>>>
>>>> Because if that's giving a 404, then you are probably not using master,
>>>> which is where this was introduced.  That file exists, whether or not you
>>>> have defined one in your profile.
>>>>
>>>>
>>>>
>>>>> Inspecting the elements show no evidence of picking up my custom.css
>>>>> file either.  I'm pretty sure I'm placing things in the right  profile
>>>>> (profile_default) as I'm not including a --profile flag on startup and the
>>>>> kernel information is being put into ~/.python/profile_default/security as
>>>>> I'd expect.
>>>>>
>>>>
>>>>> I don't know if this makes a difference, but I've set
>>>>> c.NotebookManager.notebook_dir to ~/Documents/iPython Notebooks/
>>>>>
>>>>
>>>> It doesn't, but then again, there is no such thing as an iPython
>>>> Notebook.  There are IPython Notebooks, though :)
>>>>
>>>> -MinRK
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Aug 25, 2012 at 1:42 AM, Matthias BUSSONNIER <
>>>>> bussonniermatthias@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> Le 25 août 2012 à 01:43, G B a écrit :
>>>>>>
>>>>>> > It doesn't seem to be getting picked up.  I'm running iPython 0.14
>>>>>> on OS X 10.8.1, browsing from Safari.
>>>>>> >
>>>>>> > Just to make sure I'm not being overly literal in interpreting your
>>>>>> response:
>>>>>> >
>>>>>> > My configuration directory is ~/.ipython
>>>>>> >
>>>>>> > I've put a file called 'custom.css' into
>>>>>> ~/.ipython/profile_default/static/css/
>>>>>> >
>>>>>> > I also created a directory tree at
>>>>>> ~/.ipython/profile/profile_default/static/css/ but that also didn't work.
>>>>>>  I believe the tree at ~/.ipython/profile_default/ is the correct one, but
>>>>>> I'd like to confirm that.
>>>>>> You are right on this one.
>>>>>>
>>>>>>
>>>>>> >
>>>>>> > In custom.css, I put a simple:
>>>>>> > h3 {font-style:italic;}
>>>>>>
>>>>>> I did the same and it works for me
>>>>>> .ipython/profile_default/static/css/custom.css
>>>>>>
>>>>>> >
>>>>>> > Looking at the page as loaded, the h3 elements do not carry the
>>>>>> italic style, and the custom.css style doesn't seem to be included at all.
>>>>>>  Do I need to change a configuration parameter somewhere to tell iPython to
>>>>>> look for custom.css?
>>>>>> Any file in
>>>>>> .ipython/profile_default/static/
>>>>>> will overwrite their equivalent if you launch profile_default of
>>>>>> course.
>>>>>> otherwise put the files in the correct profile or make a symlink.
>>>>>>
>>>>>> > I've closed the open notebook pages and shut down the notebook
>>>>>> server and the relaunched the server, which opens a fresh page.  Do I need
>>>>>> to do all that, or just refresh the page to pick up a new custom.css?
>>>>>> >From the test I did, you don't have to restart, just reload.
>>>>>>
>>>>>> > I'm pretty much new to everything I'm doing here-- I'm not a
>>>>>> seasoned Python developer, I've been using iPython for days, I've only
>>>>>> toyed with HTML and CSS in the past...  It's quite likely that I'm doing
>>>>>> something wrong at a very basic level.
>>>>>> > Any ideas?  Thanks for the patience...
>>>>>>
>>>>>> what does
>>>>>> http://127.0.0.1:8888/static/css/custom.css
>>>>>> give you ? Your file or not ?
>>>>>>
>>>>>> Try Safari "web inspector" (Dev menu > web inspector, or Cmd+Alt+i)
>>>>>> First tab (Element)
>>>>>> Click Magnifying glass at the bottom and click on a h3 element.
>>>>>> You should be able to inspect its css, where it inherits from on the
>>>>>> right now ... etc
>>>>>> It's a little difficult to explain by mail but by looking at the
>>>>>> difference tabs you should be able to determine which file is loaded and
>>>>>> why a css is not applied to an element.
>>>>>>
>>>>>> keep us informed.
>>>>>> --
>>>>>> Matthias
>>>>>>
>>>>>> >
>>>>>> > Thanks--
>>>>>> >  Greg
>>>>>> >
>>>>>> > On Fri, Aug 24, 2012 at 1:14 AM, Matthias BUSSONNIER <
>>>>>> bussonniermatthias@gmail.com> wrote:
>>>>>> >
>>>>>> > Le 24 août 2012 à 01:36, G B a écrit :
>>>>>> >
>>>>>> > > Is there a way to modify the notebook stylesheet?  I'd like to
>>>>>> emphasize the markdown cells and de-emphasize the code cells to make for a
>>>>>> more human readable document...  The config file doesn't seem to list a
>>>>>> parameter for the stylesheet though.
>>>>>> > Which version are you using ?
>>>>>> > In 0.12-0.13 the easiest is to write CSS in a markdown cell.
>>>>>> > In 0.14 you can overwrite the default css or ad your own on a per
>>>>>> profile basis
>>>>>> > by creating a .ipython/profile/profile_xxx/static/css/custom.css
>>>>>>  file with the rules you want inside.
>>>>>> > --
>>>>>> > Matthias
>>>>>> >
>>>>>> >
>>>>>> > >
>>>>>> > > Thanks!
>>>>>> > >  Greg
>>>>>>
>>>>>> _______________________________________________
>>>>>> IPython-User mailing list
>>>>>> IPython-User@scipy.org
>>>>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> IPython-User mailing list
>>>>> IPython-User@scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> IPython-User mailing list
>>>> IPython-User@scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>>
>>>>
>>>
>>> _______________________________________________
>>> IPython-User mailing list
>>> IPython-User@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>>
>>>
>>
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>
>>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120829/8cabb7ab/attachment-0001.html