How to set base url for markdown links in IPython?

I happily installed

 
<head>
<base href="http://complex_url_to_local_wiki:port/path/" target="_blank" />
</head>

      

in a Markdown cell in my IPython html notebook (IPython 0.12) to be able to shorten links like [wiki documentation](doc.html)

in Markdown cells.

But this makes it impossible to save the laptop (save is restored <base href='/'/>

).

Is there an (alternative) way to achieve what I am looking for? I know how to create a URL from Python code using IPython.core.display.HTML

[1], but it is much more convenient to embed links in the Markdown documentation

Thank,

Álvaro.

[1] A suboptimal solution creating a Python link is pasted below if it is helpful to someone or you have suggestions for improvement

def wurl(x, text="Node {} in wiki",
            baseurl="http://complex_url_to_local_wiki:port/path/{}"):
    """Render a link on a base URL as html."""

    from IPython.core.display import HTML
    url_t = '<a href="{baseurl}" target="_blank">{text}</a>'
    return HTML(url_t.format(baseurl=baseurl.format(x), text=text.format(x)))

      

+1


source to share





All Articles