mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-11-30 01:28:49 +00:00
187 lines
20 KiB
Plaintext
187 lines
20 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "raw",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"---\n",
|
||
|
"title: Display Jupyter Notebooks with Academic\n",
|
||
|
"subtitle: Learn how to blog in Academic using Jupyter notebooks\n",
|
||
|
"summary: Learn how to blog in Academic using Jupyter notebooks\n",
|
||
|
"authors:\n",
|
||
|
"- admin\n",
|
||
|
"tags: []\n",
|
||
|
"categories: []\n",
|
||
|
"date: \"2019-02-05T00:00:00Z\"\n",
|
||
|
"lastMod: \"2019-09-05T00:00:00Z\"\n",
|
||
|
"featured: false\n",
|
||
|
"draft: false\n",
|
||
|
"\n",
|
||
|
"# Featured image\n",
|
||
|
"# To use, add an image named `featured.jpg/png` to your page's folder. \n",
|
||
|
"image:\n",
|
||
|
" caption: \"\"\n",
|
||
|
" focal_point: \"\"\n",
|
||
|
"\n",
|
||
|
"# Projects (optional).\n",
|
||
|
"# Associate this post with one or more of your projects.\n",
|
||
|
"# Simply enter your project's folder or file name without extension.\n",
|
||
|
"# E.g. `projects = [\"internal-project\"]` references \n",
|
||
|
"# `content/project/deep-learning/index.md`.\n",
|
||
|
"# Otherwise, set `projects = []`.\n",
|
||
|
"projects: []\n",
|
||
|
"---"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAADLCAYAAABdyYYmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNi8wNS8wNE2+5nEAAAAldEVYdFNvZnR3YXJlAE1hY3JvbWVkaWEgRmlyZXdvcmtzIE1YIDI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sKVpYWICiKBgbG4s9mKiqinK5HFrwMOtUVbVv78kU1++CcrmMYrE4MKFyWDBkRez0K+fxZ9983tJj1Rli1nKEYMBymtM0SLfJCRrQ2th7sASClvm48l3g6g+B9GPA9v1IIk3TMDc3F3lPifV8R48eRbFYDPUv2VKpFFpdFA1d11Eul0P98DY/sPfv34+DBw+GUqeXer2O48ePR/rvxfqexsfHYxtGjPt3ga7rmJ6eju17t14wZEXkyrW38Bff/hVOVl71DDHiAcsl4LTV1153x2t9DVgOxzuNVHcbsMyD374KvPFV4MZvgPSnOusfULVaDbOzs7H9QrUrlUrQNA3FYrEv56f41Ot1zM7OQlXVyM6xsLCAxcVFTE5ORhZKNE3D8ePHI+ndcbKwsIBqtYrDhw9HOiwad7iyi+N7t54wZEXgyrW3cKj0Y5w5d7m3gBXabXIc6nYasgvtNjlBAlaIPVnW48//l+Zcre2Dfx+scrmMubm5ro93moDsdiWVF/NDl0FreM3Pz2Nubi6WYFKr1TA9PR3Jh7Wqqn3pLTV7ew4dOhT6sJqu65idnUWlUgl8rFtbug1qUX7v1hu
|
||
|
"text/plain": [
|
||
|
"<IPython.core.display.Image object>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from IPython.core.display import Image\n",
|
||
|
"Image('https://www.python.org/static/community_logos/python-logo-master-v3-TM-flattened.png')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Welcome to Academic!\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(\"Welcome to Academic!\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Install Python and JupyterLab\n",
|
||
|
"\n",
|
||
|
"[Install Anaconda](https://www.anaconda.com/distribution/#download-section) which includes Python 3 and JupyterLab.\n",
|
||
|
"\n",
|
||
|
"Alternatively, install JupyterLab with `pip3 install jupyterlab`."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Create or upload a Jupyter notebook\n",
|
||
|
"\n",
|
||
|
"Run the following commands in your Terminal, substituting `<MY-WEBSITE-FOLDER>` and `<SHORT-POST-TITLE>` with the file path to your Academic website folder and a short title for your blog post (use hyphens instead of spaces), respectively:"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"```bash\n",
|
||
|
"mkdir -p <MY-WEBSITE-FOLDER>/content/post/<SHORT-POST-TITLE>/\n",
|
||
|
"cd <MY-WEBSITE-FOLDER>/content/post/<SHORT-POST-TITLE>/\n",
|
||
|
"jupyter lab index.ipynb\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"The `jupyter` command above will launch the JupyterLab editor, allowing us to add Academic metadata and write the content."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Edit your post metadata\n",
|
||
|
"\n",
|
||
|
"The first cell of your Jupter notebook will contain your post metadata ([front matter](https://sourcethemes.com/academic/docs/front-matter/)).\n",
|
||
|
"\n",
|
||
|
"In Jupter, choose _Markdown_ as the type of the first cell and wrap your Academic metadata in three dashes, indicating that it is YAML front matter: \n",
|
||
|
"\n",
|
||
|
"```\n",
|
||
|
"---\n",
|
||
|
"title: My post's title\n",
|
||
|
"date: 2019-09-01\n",
|
||
|
"\n",
|
||
|
"# Put any other Academic metadata here...\n",
|
||
|
"---\n",
|
||
|
"```\n",
|
||
|
"\n",
|
||
|
"Edit the metadata of your post, using the [documentation](https://sourcethemes.com/academic/docs/managing-content) as a guide to the available options.\n",
|
||
|
"\n",
|
||
|
"To set a [featured image](https://sourcethemes.com/academic/docs/managing-content/#featured-image), place an image named `featured` into your post's folder.\n",
|
||
|
"\n",
|
||
|
"For other tips, such as using math, see the guide on [writing content with Academic](https://sourcethemes.com/academic/docs/writing-markdown-latex/). "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Convert notebook to Markdown"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"```bash\n",
|
||
|
"jupyter nbconvert index.ipynb --to markdown --NbConvertApp.output_files_dir=.\n",
|
||
|
"```"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Example\n",
|
||
|
"\n",
|
||
|
"This post was created with Jupyter. The orginal files can be found at https://github.com/gcushen/hugo-academic/tree/master/exampleSite/content/post/jupyter"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"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",
|
||
|
"version": "3.7.3"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|