mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
update 009 24/03
This commit is contained in:
parent
cfdcfe8482
commit
8370b7e62f
1 changed files with 9 additions and 10 deletions
|
|
@ -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 <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
|
||||
My favourite exercise was [this one](exercise_1).
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue