Inside a markdown cell in an ipython-notebook I'd like to be able to expand variables automatically. Can this be done?
As an example, consider the following code
from IPython.core.display import HTML
from markdown import markdown
base_url = "https://stackoverflow.com/"
markdown_string = "Two categories at [stackoverflow]({0}) are "\
"[ipython-notebook]({0}questions/tagged/ipython-notebook) and "\
"[matplotlib]({0}questions/tagged/matplotlib).".format(base_url)
HTML("<p>{}</p>".format(markdown(markdown_string)))
This produces the output cell with the links correct, all relative to base_url
, as
Two categories at stackoverflow are ipython-notebook and matplotlib.
What I would like is to be able to directly type the markdown into the cell, referencing a pre-defined variable. Is this possible?