3

I was happily setting

<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) in order to be able to abbreviate links as[wiki documentation](doc.html) in Markdown cells.

But this makes saving the notebook impossible (saving is restored by <base href='/'/>).

Is there any (alternative) way to achieve what I am seeking? I know how to produce the URL from Python code by use of IPython.core.display.HTML[1], but it is considerably more convenient to inline the links in the Markdown documentation

Thanks,

Álvaro.

[1] The non-optimal solution producing the link from Python is pasted below in case it is useful for somebody 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)))
meteore
  • 4,635
  • 2
  • 22
  • 14
  • Markdown is entirely processed in the browser, so I guess any solution is going to involve Javascript. – Thomas K Jun 14 '12 at 17:31

0 Answers0