Keep Sharp

Collection of Bloody Lessons

This will be the logs of my struggling in fixing all kinds of messy bugs

01/03/2015: converting ipython notebook into html, style is ugly, math symbols and tabels in markdown cell are not rendered, no title of the html page

Reason:

  • I was using ipython 1.2.1, css style is ugly itself, if using ipython 2.1.0, style will be much better, but then liquid-tags plugin in pelican will not work properly.
  • In "dist-packages/IPython/nbconvert/templates" folder, there are templates for how to convert notebook to html, in "html_full.tpl" file, change mathjax domain address to "cdn.mathjax.org", check nbconvert: Math is not displayed in the html output.
  • Ipython nbconvert uses pandoc for converting to other formats, i was using pandoc 1.9 by default installation with "sudo apt-get install pandoc", it requires a new version of pandoc so that tables in markdown cell can be rendered, chech HTML tables aren't converted to latex.
  • ** text here ** can be shown correctly in notebook, but still shown as ** text here ** instead of text here in the exported html file.

Solution:

  • Fix mathjax domain both in ipython folder (for ipython1 series, is inside "html_full.tpl", for ipython2 series, is inside "mathjax.tpl") and in liquid-tags plugin folder (inside "notebook.py") so math symbols can be rendered
  • Remove pandoc 1.9, install pandoc 1.13 using .deb file, then tables in markdown cell can be rendered.
  • In "html_full.tpl" file, change title to "{{resources['metadata']['name']}}" so html page title can be extracted correctly.
  • Delete space between ** and to be emphasized text.
  • Stay with ipython1, since css changed a lot in ipython2 and liquid_tags only works with ipython1, other wise there will be no code highlighting in notebook cells after rendered, check discssions in migrating from octopress to pelican, also liquid-tags requires python markdown 2.3 instead of 2.5 as i mentioned there.

Result:

  • For nbconverted html file: has page title, math symbols rendered, tabel in markdown cells rendered, emphasized text is emphasized. However, rendered html file is not that beautiful though every part now can be rendered.
  • For pelican: only bokeh figures have some bounding boxes that makes it not that cool comparing to the perfectly rendered html file by ipython2.

01/22/2016: unable to load disqus in pelican

For a whole year, I got messed up with disqus comment of my blog and too busy or lazy to fix it, today finally determined to fix it. Finally it has nothing to do with SITEURL empty or not empty, RELATIVE_URLS True or False as most posts said. I found the fix from here. Currently my SITEURL is empty and RELATIVE_URLS is True.

Fix:

  • add DISQUSURL = 'https://blog.yourdomain.com' inside pelicanconf.py
  • my theme is pelican-octopress-theme, so change file pelican-octopress-theme/templates/_includes/disqus_script.html:
          var disqus_url = '{{ DISQUSURL }}/{{ article.url }}';

now disqus comment will be shown properly and if you check the source code of the page and search disqus_url, it will not show an relative path like ./your-post-title.html anymore

01/22/2016: incompatibility between liquid-tags and python markdown 2.5 above

Fix:

Comments