From a39b05059918202c9a1ce4cb20287727b729c610 Mon Sep 17 00:00:00 2001 From: Julie Kirsch Date: Mon, 4 Nov 2024 11:44:10 +0100 Subject: [PATCH 1/3] update --- book/features/custom_download.md | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/book/features/custom_download.md b/book/features/custom_download.md index 4ee96cd..f866e2c 100644 --- a/book/features/custom_download.md +++ b/book/features/custom_download.md @@ -9,10 +9,10 @@ You can control the download option of the book in two ways: - Disabling downloading using cell tags `disable-download-page` - Add / replace download link with custom link using `spinhx-download-link-replacer` -## Disabling download +## 1. Disabling download If you add `disable-download-page` as a cell tag to a cell in a python notebook, the download button ({fa}`download`) will disappear from the topright corner. The cell tag can be added to any code cell in the notebook. This function might be handy if your page includes code which you don't want the students to see. Be aware that this also removes the option to download a PDF of the page. -## Add/replace download link +## 2. Add/replace download link The download link {fa}`download` --> {fa}`file`{guilabel}`.ipynb` can be replaced by using the following code in any markdown / notebook file: ````md ```{custom_download_link} @@ -26,19 +26,9 @@ An explanation of the options of this command is given on https://gitlab.tudelft A potential application of this functionality is when creating a page in which students have to do some coding. Downloading the page allows the student to save their work and work with their local environment. However, the original source file might include code (jupyterbook formatting, widgets, answers) which is not necessary for students. You can make a copy of the notebook file without these elements and replace the {fa}`file`{guilabel}`.ipynb` link to this custom notebook file. Furthermore, you can add any additional data as an additional {fa}`file`{guilabel}`.zip` file. -### Installation instructions -To make use of this functionality, you have to install the `download_link_replace` package by running the following line in your command line: -``` -pip install git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer -``` +### 2.1. Installation instructions + +```{include} book/external/Download-Link_Replacer/README.md -Furthermore, you should add the following line to `requirements.txt` ``` -download_link_replacer @ git+https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer -``` -and to `_config.yml`: -``` -sphinx: - extra_extensions: - - download_link_replacer -``` \ No newline at end of file +book\external\Download-Link-Replacer\README.md \ No newline at end of file From df9d49b34be650f132fc9bf424f1c79f94188e57 Mon Sep 17 00:00:00 2001 From: Julie Kirsch Date: Mon, 4 Nov 2024 11:53:21 +0100 Subject: [PATCH 2/3] commit change --- book/external/Download-Link-Replacer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/external/Download-Link-Replacer b/book/external/Download-Link-Replacer index 8fc4a37..cf0d3c9 160000 --- a/book/external/Download-Link-Replacer +++ b/book/external/Download-Link-Replacer @@ -1 +1 @@ -Subproject commit 8fc4a376870afacba5351c731f55130dfa88d3fb +Subproject commit cf0d3c99f3e0bd549ac2d38d8117f9b9ea5a179c From 29f88d922b171e0d7e75135cabe1793e0b867ef2 Mon Sep 17 00:00:00 2001 From: Julie Kirsch Date: Mon, 4 Nov 2024 11:59:04 +0100 Subject: [PATCH 3/3] toc change --- book/_toc.yml | 2 +- book/features/custom_download.md | 34 -------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 book/features/custom_download.md diff --git a/book/_toc.yml b/book/_toc.yml index c484808..e875ba8 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -44,7 +44,7 @@ parts: - file: external/TeachBooks/README.md - file: external/deploy-book-workflow/README.md - file: external/Nested-Books/README.md - - file: features/custom_download.md + - file: external/Download-Link-Replacer/README.md - file: external/Sphinx-Image-Inverter/README.md - file: external/JupyterBook-Patches/README.md - file: features/interactive_element.ipynb diff --git a/book/features/custom_download.md b/book/features/custom_download.md deleted file mode 100644 index f866e2c..0000000 --- a/book/features/custom_download.md +++ /dev/null @@ -1,34 +0,0 @@ -# Page download options - -```{admonition} User types -:class: tip -This section is useful for user type 4-5. -``` - -You can control the download option of the book in two ways: - - Disabling downloading using cell tags `disable-download-page` - - Add / replace download link with custom link using `spinhx-download-link-replacer` - -## 1. Disabling download -If you add `disable-download-page` as a cell tag to a cell in a python notebook, the download button ({fa}`download`) will disappear from the topright corner. The cell tag can be added to any code cell in the notebook. This function might be handy if your page includes code which you don't want the students to see. Be aware that this also removes the option to download a PDF of the page. - -## 2. Add/replace download link -The download link {fa}`download` --> {fa}`file`{guilabel}`.ipynb` can be replaced by using the following code in any markdown / notebook file: -````md -```{custom_download_link} -:text: "Custom text" -:replace_default: "True" -``` -```` - -An explanation of the options of this command is given on https://gitlab.tudelft.nl/mude/sphinx-download-link-replacer. - -A potential application of this functionality is when creating a page in which students have to do some coding. Downloading the page allows the student to save their work and work with their local environment. However, the original source file might include code (jupyterbook formatting, widgets, answers) which is not necessary for students. You can make a copy of the notebook file without these elements and replace the {fa}`file`{guilabel}`.ipynb` link to this custom notebook file. Furthermore, you can add any additional data as an additional {fa}`file`{guilabel}`.zip` file. - - -### 2.1. Installation instructions - -```{include} book/external/Download-Link_Replacer/README.md - -``` -book\external\Download-Link-Replacer\README.md \ No newline at end of file