update 009 24/03

This commit is contained in:
Katia Gatt 2025-03-24 23:30:52 +01:00
parent cfdcfe8482
commit 8370b7e62f

View file

@ -12,7 +12,8 @@ Referencing elements properly ensures that readers can navigate your book more e
## 1. Referencing a Chapter or Section ## 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 ```md
[Text to display](path/to/file.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 ```md
[Go to Exercise 7](../exercises/007.md) [Go to Exercise 7](../exercises/007.md)
``` ```
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.
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:
```md ```md
(exercise_1)= (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... 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 ```md
My favourite exercise was {ref}`exercise_1`. My favourite exercise was {ref}`exercise_1`.
``` ```
This will display: 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 ```md
My favourite exercise was {ref}`the first one <exercise_1>`. My favourite exercise was {ref}`the first one <exercise_1>`.
``` ```
This will display: My favourite exercise was {ref}`the first one <exercise_1>`. This will display: My favourite exercise was {ref}`the first one <exercise_1>`.
- 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 ```md
My favourite exercise was [this one](exercise_1). My favourite exercise was [this one](exercise_1).
``` ```