From 92ed13dbe3ed7766daac6c551924ac4223a698ab Mon Sep 17 00:00:00 2001
From: "Afshin T. Darian" <git@darian.af>
Date: Thu, 1 Apr 2021 16:11:04 +0100
Subject: [PATCH] Add Changelog to Sphinx Docs

---
 .gitignore                          |  3 +++
 docs/doc-requirements.txt           |  3 ++-
 docs/environment.yml                | 17 +++--------------
 docs/source/conf.py                 | 13 +++++++++++++
 docs/source/developers/contents.rst |  2 +-
 docs/source/other/full-config.rst   |  1 +
 docs/source/other/index.rst         |  3 ++-
 7 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/.gitignore b/.gitignore
index cc334c24d6..1a246f57fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,6 @@ config.rst
 /.project
 /.pydevproject
 
+# copied changelog file
+docs/source/other/changelog.md
+
diff --git a/docs/doc-requirements.txt b/docs/doc-requirements.txt
index 48b3eda1d0..189bf8f566 100644
--- a/docs/doc-requirements.txt
+++ b/docs/doc-requirements.txt
@@ -8,4 +8,5 @@ prometheus_client
 sphinxcontrib_github_alt
 sphinxcontrib-openapi
 sphinxemoji
-git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master
\ No newline at end of file
+myst-parser
+pydata_sphinx_theme
diff --git a/docs/environment.yml b/docs/environment.yml
index 61eee5ed3f..55a75074bb 100644
--- a/docs/environment.yml
+++ b/docs/environment.yml
@@ -1,17 +1,6 @@
 name: jupyter_server_docs
 dependencies:
-- python=3.7
+- python=3.8
+- pip
 - pip:
-  - sphinx
-  - jinja2
-  - tornado
-  - jupyter_client
-  - ipykernel
-  - nbformat
-  - Send2Trash
-  - prometheus_client
-  - sphinxcontrib_github_alt
-  - sphinxcontrib-openapi
-  - sphinxemoji
-  - terminado
-  - git+https://github.com/pandas-dev/pydata-sphinx-theme.git@master
\ No newline at end of file
+  - -r doc-requirements.txt
diff --git a/docs/source/conf.py b/docs/source/conf.py
index e105e82d40..79f9df3ed6 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -15,7 +15,12 @@
 
 import sys
 import os
+import os.path as osp
 import shlex
+import shutil
+
+HERE = osp.abspath(osp.dirname(__file__))
+
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -63,6 +68,7 @@
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
 extensions = [
+    'myst_parser',
     'sphinx.ext.autodoc',
     'sphinx.ext.doctest',
     'sphinx.ext.intersphinx',
@@ -74,6 +80,8 @@
     'sphinxemoji.sphinxemoji'
 ]
 
+myst_enable_extensions = ["html_image"]
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -371,3 +379,8 @@
 
 # import before any doc is built, so _ is guaranteed to be injected
 import jupyter_server.transutils
+
+
+def setup(app):
+    dest = osp.join(HERE, 'other', 'changelog.md')
+    shutil.copy(osp.join(HERE, '..', '..', 'CHANGELOG.md'), dest)
diff --git a/docs/source/developers/contents.rst b/docs/source/developers/contents.rst
index f5ac3c83ad..a0a0296fc4 100644
--- a/docs/source/developers/contents.rst
+++ b/docs/source/developers/contents.rst
@@ -281,7 +281,7 @@ An asynchronous version of the Contents API is available to run slow IO processe
 
 .. note::
 
-   .. _contentfree:
+   .. _asynccontents:
 
    In most cases, the non-asynchronous Contents API is performant for local filesystems.
    However, if the Jupyter Notebook web application is interacting with a high-latent virtual filesystem, you may see performance gains by using the asynchronous version.
diff --git a/docs/source/other/full-config.rst b/docs/source/other/full-config.rst
index 050af18ad2..52d0bcf3ff 100644
--- a/docs/source/other/full-config.rst
+++ b/docs/source/other/full-config.rst
@@ -1388,3 +1388,4 @@ GatewayClient.ws_url : Unicode
 
     The websocket url of the Kernel or Enterprise Gateway server.  If not provided, this value
     will correspond to the value of the Gateway url with 'ws' in place of 'http'.  (JUPYTER_GATEWAY_WS_URL env var)
+
diff --git a/docs/source/other/index.rst b/docs/source/other/index.rst
index 50dc4f39c3..e3ddd8d96b 100644
--- a/docs/source/other/index.rst
+++ b/docs/source/other/index.rst
@@ -6,4 +6,5 @@ Other helpful documentation
 
    links
    faq
-   full-config
\ No newline at end of file
+   full-config
+   changelog