资讯专栏INFORMATION COLUMN

如何将 ipynb 发布到 blog 中?

zhigoo / 2983人阅读

摘要:如何将发布到中原文是也乎原未天然就内置了这种能力

Title: 如何将 ipynb 发布到 blog 中?
Date: 2014-11-27
Tags: Pythonic,FW,ipynb,tutorial
Slug: 141127-ipynb-into-blog

原文: prooffreader plus: How to quickly turn an IPython notebook into a blog post

IPython notebooks are great for many things, but they"re a little awkward to embed in blog post platforms like Blogger, Wordpress, etc. When the nbconvert feature was a standalone command-line tool, there was a blog export template, but that seems to have disappeared now that nbconvert has been folded within IPython.

Out of the box, nbconvert just has two html export options:

--html

which includes a lot of CSS that interferes with a blog"s CSS, and:

--html --template basic

which has no CSS and so pretty much negates the benefit of using an IPython notebook. However, it does have CSS classess in the text.

My solution was to whip up a quick CSS stylesheet that could be included in the blog post. It seems to work pretty well; you can have a look at:

an IPython notebook in nbviewer of a recent blog post of mine

the blog version after applying this stylesheet.

Note that, for aesthetic reasons, I removed all the

In [1]

-style tags because of the narrow columns on this blog. Your mileage may vary.

1. Convert .ipynb notebook to HTML

In the terminal, navigate to the folder containing the .ipynb file and type:

ipython nbconvert --to html --template basic filename.ipynb
2. Paste HTML in blog

Note: if you"re using the Blogger platform, never switch back to the Compose interface after you use the HTML interface, it changes all your tags.

3. Add CSS to blog HTML

This seems to reproduce the native syntax highlighting of IPython.


是也乎

原未 IPy[:] notebook 天然就内置了这种能力!

Changelog

140107 move into Pelican as zoomquiet.io

131106 pub. EKR to Chinese programmer — I. M. H. O. — Medium

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/37468.html

相关文章

  • 打造数据科学作品集:搭建一个数据科学博客

    摘要:读完本文,你将学会如何使用静态网站生成器,搭建一个属于自己的博客,用来展示数据科学作品。静态网站基本上,一个静态网站就是一个全是文件的文件夹。建立静态网站的一种方法是手写,然后上传所有的文件到服务器。 这是「打造数据科学作品集」系列文章的第二篇。如果你喜欢该系列,而且想知道下一篇文章什么时候发布,你可以订阅我们。读完本文,你将学会如何使用 Pelican 静态网站生成器,搭建一个属于...

    iamyoung001 评论0 收藏0
  • 8步从Python白板专家,从基础深度学习

    摘要:去吧,参加一个在上正在举办的实时比赛吧试试你所学到的全部知识微软雅黑深度学习终于看到这个,兴奋吧现在,你已经学到了绝大多数关于机器学习的技术,是时候试试深度学习了。微软雅黑对于深度学习,我也是个新手,就请把这些建议当作参考吧。 如果你想做一个数据科学家,或者作为一个数据科学家你想扩展自己的工具和知识库,那么,你来对地方了。这篇文章的目的,是给刚开始使用Python进行数据分析的人,指明一条全...

    Zachary 评论0 收藏0
  • 数据分析遇PDF文本,怎么用Python批量提取内容

    摘要:复杂系统仿真的微博客虚假信息扩散模型研究面向影子分析的社交媒体竞争情报搜集面向人机协同的移动互联网政务门户探析经验证。微博客的企业竞争情报搜集移动社交媒体用户隐私保护对策研究注意这里的提示,原先的个文件没有被再次抽取,只有个新文件被抽取。 showImg(https://segmentfault.com/img/bVbiU7y?w=1000&h=508); 本文为你展示,如何用Pyth...

    cloud 评论0 收藏0
  • [原]深入对比数据科学工具箱:Python和R 的 Web 编辑器

    摘要:概述工欲善其事必先利其器,如果现在要评选数据科学中最好用的编辑器注意一定是可以通过访问的,和一定是角逐的最大热门,正确使用编辑器可以很大地提升我们的工作效率。 概述 showImg(https://segmentfault.com/img/bVAdol); 工欲善其事必先利其器,如果现在要评选数据科学中最好用的Web 编辑器(注意一定是可以通过Web访问的),RStudio和Jupyt...

    RobinQu 评论0 收藏0
  • 迁移学习在图像分类的简单应用策略

    摘要:地址为什么使用迁移学习根据联合创始人斯坦福副教授吴恩达介绍,迁移学习将会成为机器学习商业成就的下一驱动力。迁移学习是一种机器学习技术,允许在特定的数据集上再利用已训练的卷积神经网络,并将其调整或迁移到其他数据集。 GitHub 地址:https://github.com/miguelgfierro/sciblog_support/blob/master/A_Gentle_Introducti...

    BigNerdCoding 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<