[IPython-dev] Making custom converter/template with nbconvert

Raniere Silva ra092767 at ime.unicamp.br
Sat Jan 3 21:27:02 EST 2015


Hi Rafał,

> I have some problem with figures that are put inside text in markdowns,
> i.ex. as
> ![some_caption](files/dot.png)
> which goes in html into <img src="dot.png" alt="some_caption" /><p
> class="caption">caption</p>
> (as a template very similar to basic one).
> 
> How can force converter to not skip 'files/' to have src="files/dot.png"?
> Probably it lies somewhere in template but I couldn't localize it.

I couldn't reproduce your problem.

    $ cat sample.ipynb
    {
     "cells": [
      {
       "cell_type": "markdown",
       "metadata": {},
       "source": [
        "![foo](folder/bar.jpg)"
       ]
      },
      {
       "cell_type": "code",
       "execution_count": null,
       "metadata": {
        "collapsed": true
       },
       "outputs": [],
       "source": []
      }
     ],
     "metadata": {
      "kernelspec": {
       "display_name": "IPython (Python 3)",
       "name": "python3"
      },
      "language_info": {
       "codemirror_mode": {
        "name": "ipython",
        "version": 3
       },
       "file_extension": ".py",
       "mimetype": "text/x-python",
       "name": "python",
       "nbconvert_exporter": "python",
       "pygments_lexer": "ipython3"
      },
      "signature": "sha256:5c8cb31d4083cbf815d3e1dff7a3cc229fa54b9c02cff82af4548cef72581573"
     },
     "nbformat": 4,
     "nbformat_minor": 0
    }
    $ ipython nbconvert --to html sample.ipynb
    [NbConvertApp] Using existing profile dir: '/home/raniere/.ipython/profile_default'
    [NbConvertApp] Converting notebook sample.ipynb to html
    [NbConvertApp] Support files will be in sample_files/
    [NbConvertApp] Loaded template full.tpl
    [NbConvertApp] Writing 223380 bytes to sample.html
    $ grep '<img' sample.html
    <p><img src="folder/bar.jpg" alt="foo"></p>

What version of IPython/Jupyter are you using? I tested with

    $ ipython --version
    3.0.0-dev

Cheers,
Raniere
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150104/78c6ae6b/attachment.sig>


More information about the IPython-dev mailing list