From cc93667296118e6c2e43312850e129f475750f71 Mon Sep 17 00:00:00 2001 From: Freek Pols Date: Wed, 4 Sep 2024 13:22:14 +0200 Subject: [PATCH 1/2] Update file jupyterbook.md --- book/basic-features/jupyterbook.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/book/basic-features/jupyterbook.md b/book/basic-features/jupyterbook.md index 047b3d7..c9e3028 100644 --- a/book/basic-features/jupyterbook.md +++ b/book/basic-features/jupyterbook.md @@ -111,4 +111,27 @@ parts: sections: - file: section_1_1 - file: section_1_2 +``` + +## Including a chapter twice +In some cases you want to include the same chapter in two different places in your book (for instance parts). However, you do not want to make the same adjustments in different files, the content should only 'live' in one place. The solution is to use `include`: + +``` {code-cell} + +```{include} Argument +``` + +``` + +The *argument* in this case is the location of the file you want to include (for instance: /book/1 mechanics/1H newton 3/demo1.md). + +```{Note} +Make sure to adjust your config file: +sphinx: + config: + myst_enable_extensions: + - include +``` + +```{include} /book/basic-features/equations.md ``` \ No newline at end of file From 0c5dc607388de71bb09d46374638e1c73cd4d993 Mon Sep 17 00:00:00 2001 From: Freek Pols Date: Wed, 4 Sep 2024 13:30:24 +0200 Subject: [PATCH 2/2] excl config, incl example --- book/basic-features/jupyterbook.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/book/basic-features/jupyterbook.md b/book/basic-features/jupyterbook.md index c9e3028..214c4a1 100644 --- a/book/basic-features/jupyterbook.md +++ b/book/basic-features/jupyterbook.md @@ -123,15 +123,8 @@ In some cases you want to include the same chapter in two different places in yo ``` -The *argument* in this case is the location of the file you want to include (for instance: /book/1 mechanics/1H newton 3/demo1.md). +The *argument* in this case is the location of the file you want to include (for instance: /book/1 mechanics/1H newton 3/demo1.md). We provide an example of the use of include below. -```{Note} -Make sure to adjust your config file: -sphinx: - config: - myst_enable_extensions: - - include -``` ```{include} /book/basic-features/equations.md ``` \ No newline at end of file