From 8370b7e62f059ca5e6360b7aa7fcc304703178ba Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Mon, 24 Mar 2025 23:30:52 +0100 Subject: [PATCH] update 009 24/03 --- book/syntax_exercises/009.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index f3730e6..8b23a46 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -12,7 +12,8 @@ Referencing elements properly ensures that readers can navigate your book more e ## 1. Referencing a Chapter or Section -To create a reference to another chapter or section, use the following syntax: +1. Open the Markdown file where you want to add a reference. +2. Lets start with the simplest way to create a reference to another chapter or section. This is by directly linking it through the file path as shown in the following syntax: ```md [Text to display](path/to/file.md) @@ -23,10 +24,7 @@ For example, if you want to link to Exercise 7, you can write: ```md [Go to Exercise 7](../exercises/007.md) ``` - -Alternatively, you can use `{ref}` to reference a section with a target header. - -First, define the section you want to reference by assigning it an identifier: +3. Try out another way of referencing by using a target header. Navigate to the chapter or section you want to reference and assign it an identifier using `{ref}` as shown in the example below. ```md (exercise_1)= @@ -34,22 +32,23 @@ First, define the section you want to reference by assigning it an identifier: Let's start with the most basic edit: add some text to a file and see that the website is updated... ``` +4. Now, lets explore three different ways to reference this section! For the first method, we use the standard title text by calling the identifier as follows: -Then, you can reference this section in three ways: - -- Using the standard title text: ```md My favourite exercise was {ref}`exercise_1`. ``` This will display: My favourite exercise was {ref}`exercise_1`. -- Specifying a custom title text: +5. For the second method, we want to refer to the section using a custom title text. Try this out by placing the text that you want to be displayed within the `` and calling the identifier within the <> as follows: + ```md My favourite exercise was {ref}`the first one `. ``` This will display: My favourite exercise was {ref}`the first one `. -- Using Markdown syntax: +6. The final method uses markdown syntax to also display a custom title text. Refer to the desired section once again, this time by putting the custom text within the [] and calling the identifier within the <> as shown below: + + ```md My favourite exercise was [this one](exercise_1). ```