V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
cqcn1991
V2EX  ›  问与答

想给 ipython notebook 写个这样的功能,应该怎么做?

  •  
  •   cqcn1991 · Aug 30, 2015 · 1973 views
    This topic created in 3897 days ago, the information mentioned may be changed or developed.

    写 ipython notebook ,经常会写得比较长。
    比如 http://nbviewer.ipython.org/github/cs109/2014/blob/master/homework-solutions/HW2-solutions.ipynb 浏览起来很不方便,我考虑是不是可以加一个 sidebar ,这样可以方便在各个内容之间跳转。

    不过之前都没看过源码,也没写过 Python 的程序,不知道如何下手?

    关于这个功能具体的做法,我大概想了一下:
    结合 markdown 的语法,对 cell 的内容,自动识别 H1,H2,H3 这样的标题,然后自动添加到 sidebar 中即可
    剩下的就是 Html 里面的 a 跳转到#链接了

    6 replies    2015-08-31 02:51:15 +08:00
    halfcrazy
        1
    halfcrazy  
       Aug 30, 2015
    类似 markdown 里面 toc 的东西?
    cqcn1991
        2
    cqcn1991  
    OP
       Aug 30, 2015 via iPhone
    @halfcrazy 那是什么?
    halfcrazy
        3
    halfcrazy  
       Aug 30, 2015
    chengzhoukun
        4
    chengzhoukun  
       Aug 30, 2015
    ipython notebook 是用 tornado web framework 写的,可能得学一下 tornado
    cqcn1991
        5
    cqcn1991  
    OP
       Aug 30, 2015 via iPhone
    @halfcrazy cool,原来已经有人写过了,就是这种
    khowarizmi
        6
    khowarizmi  
       Aug 31, 2015
    好像可以加代码折叠
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2706 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 14:31 · PVG 22:31 · LAX 07:31 · JFK 10:31
    ♥ Do have faith in what you're doing.