in scripts/nb_to_md.py [0:0]
def publish_markdown(self):
"""Updates the Markdown version of a Jupyter notebook file."""
nb = self.get_clean_notebook();
exporter = MarkdownExporter()
(content, resources) = exporter.from_notebook_node(nb)
markdown = self.get_markdown_file()
# separate front matter from content
title, description, weight, content = self.parse_front_matter(
content, markdown)
template = ('+++\n'
'title = "{0}"\n'
'description = "{1}"\n'
'weight = {2}\n'
'+++\n\n'
'<!--\n'
'AUTOGENERATED FROM {4}\n'
'PLEASE UPDATE THE JUPYTER NOTEBOOK AND REGENERATE THIS FILE'
' USING scripts/nb_to_md.py.'
'-->\n\n'
'<style>\n'
'.notebook-links {{display: flex; margin: 1em 0;}}\n'
'.notebook-links a {{padding: .75em; margin-right: .75em;'
' font-weight: bold;}}\n'
'a.colab-link {{\n'
'padding-left: 3.25em;\n'
'background-image: url(/docs/images/logos/colab.ico);\n'
'background-repeat: no-repeat;\n'
'background-size: contain;\n'
'}}\n'
'a.github-link {{\n'
'padding-left: 2.75em;\n'
'background-image: url(/docs/images/logos/github.png);\n'
'background-repeat: no-repeat;\n'
'background-size: auto 75%;\n'
'background-position: left center;\n'
'}}\n'
'</style>\n'
'<div class="notebook-links">\n'
'<a class="colab-link" href="https://colab.research.google.com/'
'github/kubeflow/website/blob/master/{4}">Run in Google Colab'
'</a>\n'
'<a class="github-link" href="https://github.com/kubeflow/websi'
'te/blob/master/{4}">View source on GitHub</a>\n'
'</div>\n\n'
'{3}'
'\n\n'
'<div class="notebook-links">\n'
'<a class="colab-link" href="https://colab.research.google.com/'
'github/kubeflow/website/blob/master/{4}">Run in Google Colab'
'</a>\n'
'<a class="github-link" href="https://github.com/kubeflow/websi'
'te/blob/master/{4}">View source on GitHub</a>\n'
'</div>')
markdown.write_file(
template.format(title, description, weight, content, self.file_path))