[IPython-User] Some thoughts on typography; how do they fit with current progress?

Matthias BUSSONNIER bussonniermatthias@gmail....
Tue Feb 11 00:46:02 CST 2014


Hi adam. 

Before forgetting, why IPython-user and not IPython-dev ?

Le 10 févr. 2014 à 19:02, Adam Hughes a écrit :

> Before I get to that, I noticed that the notebook viewer does not render the background image of a notebook that, on my local machine, appears fine.  It also does not center the notebook within the viewing frame.  Is this expected?  IE, that some disparity between rendering in the nbviewer and on a local machine is unavoidable? 

we do our best to keep them as close as possible, please file an issue and/or make a PR

> 
> In any case, the richness of the CSS really inspired me.  I really liked Brian Granger's "load_style()" function, and shamelessly bundled some of this behavior in an active project of ours.  (Tried to give credit and cite original sources in the source code)  We put a few .css files along with the bundle with the intention of having users changing the notebook style in one line.  Basically as follows: 

I see several problem with that. 

1) is that you shouldn't have to use a kernel action to change the theme. 
2) is that it bundle the theme in the notebook and theme is by definition not part of the content. 
    if the html that wrap the notebook changes, (and by if I mean when it will change), your notebook will be broken. 
   also embededing css will probably break export to rst, pdf .... etc.
3) it blocks browser rendering.

We did discuss about that at last meeting, and at some point we want to add a metadata key to the notebook that give a theme "name" and/or url. 
A list of default theme would be "blessed" and maintained while the app evolve to be sure they do not "break" in future. 


Any way for the time being, we are out of bandwidth to work on that, and keep in mind that **if** we have theme, 
only a few will be maintained by us as it takes a lot of bandwidth. 

You should have a look at less.js this is how we build our css using variable. 
I think there are python binding, but it mostly works using node. 

see there for a "theme" builder: https://gist.github.com/Carreau/8637113#file-maketheme-js


> And the notebook would format in place.  I think journals would eat it up if supplemental notebooks were rendered in similar typeset to the publication.  I think that pushing forward on this front is really important; appearance is everything unfortunately. 
> 
> Therefore, if you guys think that this would help compliment the notebook, and that there's not already an official PR in to address this, I'd like to put a small side package together that would do the following: 

As usual tool like that are better in a separate repo at the beginning to have a faster iterative cycle.

Also a Python builder will make the tool only usable in python kernel, and prevent any other language to use the
tools. what a shame :-)

I keep it short I have to go, but nice to see people working on that. 

-- 
M

> 
> 1. Accumulate as many .css files that we can collect and bake them directly in so that they can be loaded into loadstyle() by name (while still supporting url and local .css file loads as Brian has already designed it) 
> 2. Start seriously trying to reproduce styles from important publication sources. 
> 3. Potentially provide a "builder" tool that publicizes the most salient CSS features in a pythonic interface.  For example maybe the builder API might look like this: 
> 
> from nbstyles import Builder 
> 
> b = Builder(startwith='APS.css') 
> b.set_background( 'red' ) 
> b.set_logo('our_lab.png', alight='top right') 
> b.align_notebook('center') 
> b.code_text = 'Helvetica' 
> b.inout_prompt(False) 
> b.export('APS_Modified.css') 
> 
> That would allow a user to take a style, modify certain features of it and save the changes without ever mucking with .css. 
> 
> What are your impressions of this?  Again, I'd like to make this quickly as a bandaid until the features are treated in earnest by the core developers. 
> 
> Also, I don't have any javascript skills, but realize that a certain level of customiziation beyond the CSS is available through editing the .js file. 
> 
> Thanks
> <doge.png>_______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user



More information about the IPython-User mailing list