Skip to content

Commit a75066e

Browse files
committed
docs: use autorefs for section references
1 parent 0bdd42a commit a75066e

File tree

6 files changed

+68
-71
lines changed

6 files changed

+68
-71
lines changed

docs/comparisons.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ docs! We don't want to be biased, but it's easy that we tend to be:
3535
[jinja]: https://jinja.palletsprojects.com/
3636
[ejs]: https://ejs.co/
3737

38-
[^1]:
39-
The file itself can
40-
[include other YAML files](configuring.md#include-other-yaml-files).
41-
38+
[^1]: The file itself can [include other YAML files][include-other-yaml-files].
4239
[^2]:
4340
Git repo is recommended to be able to use advanced features such as template tagging
4441
and smart updates.

docs/configuring.md

+52-52
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ It is important that you understand how Copier works. It has 2 kinds of configur
1313
Copier reads **settings** from these sources, in this order of priority:
1414

1515
1. Command line or API arguments.
16-
1. [The `copier.yml` file](#the-copieryml-file). Settings here always start with an
16+
1. [The `copier.yml` file][the-copieryml-file]. Settings here always start with an
1717
underscore (e.g. `_min_copier_version`).
1818

1919
!!! info
2020

2121
Some settings are _only_ available as CLI arguments, and some others _only_ as
2222
template configurations. Some behave differently depending on where they are
23-
defined. [Check the docs for each specific setting](#available-settings).
23+
defined. [Check the docs for each specific setting][available-settings].
2424

2525
Copier obtains **answers** from these sources, in this order of priority:
2626

2727
1. Command line or API arguments.
2828
1. Asking the user. Notice that Copier will not ask any questions answered in the
2929
previous source.
30-
1. [Answer from last execution](#the-copier-answersyml-file).
31-
1. Default values defined in [the `copier.yml` file](#the-copieryml-file).
30+
1. [Answer from last execution][the-copier-answersyml-file].
31+
1. Default values defined in [the `copier.yml` file][the-copieryml-file].
3232

3333
## The `copier.yml` file
3434

3535
The `copier.yml` (or `copier.yaml`) file is found in the root of the template, and it is
3636
the main entrypoint for managing your template configuration. It will be read and used
3737
for two purposes:
3838

39-
- [Prompting the user for information](#questions).
40-
- [Applying template settings](#available-settings) (excluding files, setting
41-
arguments defaults, etc.).
39+
- [Prompting the user for information][questions].
40+
- [Applying template settings][available-settings] (excluding files, setting arguments
41+
defaults, etc.).
4242

4343
### Questions
4444

@@ -156,7 +156,7 @@ Supported keys:
156156
long, you can use
157157
[YAML anchors](https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html).
158158
- **secret**: When `true`, it hides the prompt displaying asterisks (`*****`) and
159-
doesn't save the answer in [the answers file](#the-copier-answersyml-file). When
159+
doesn't save the answer in [the answers file][the-copier-answersyml-file]. When
160160
`true`, a default value is required.
161161
- **placeholder**: To provide a visual example for what would be a good value. It is
162162
only shown while the answer is empty, so maybe it doesn't make much sense to provide
@@ -455,12 +455,12 @@ your_template
455455

456456
!!! important
457457

458-
Note that the chosen [template suffix](#templates_suffix)
458+
Note that the chosen [template suffix][templates_suffix]
459459
**must** appear outside of the Jinja condition,
460460
otherwise the whole file won't be considered a template and will
461461
be copied as such in generated projects.
462462

463-
You can even use the answers of questions with [choices](#advanced-prompt-formatting):
463+
You can even use the answers of questions with [choices][advanced-prompt-formatting]:
464464

465465
```yaml title="copier.yml"
466466
ci:
@@ -483,7 +483,7 @@ your_template
483483

484484
!!! important
485485

486-
Contrary to files, directories **must not** end with the [template suffix](#templates_suffix).
486+
Contrary to files, directories **must not** end with the [template suffix][templates_suffix].
487487

488488
!!! warning
489489

@@ -627,14 +627,14 @@ your_template
627627
...
628628
```
629629

630-
Then, make sure to [exclude](#exclude) this folder
630+
Then, make sure to [exclude][exclude] this folder
631631

632632
```yaml title="copier.yml"
633633
_exclude:
634634
- includes
635635
```
636636

637-
or use a [subdirectory](#subdirectory), e.g.:
637+
or use a [subdirectory][subdirectory], e.g.:
638638

639639
```yaml title="copier.yml"
640640
_subdirectory: template
@@ -655,11 +655,11 @@ reason, Copier provides a function
655655

656656
## Available settings
657657

658-
Template settings alter how the template is rendered.
659-
[They come from several sources](#configuration-sources).
658+
Template settings alter how the template is rendered. [They come from several
659+
sources][configuration-sources].
660660

661-
Remember that **the key must be prefixed with an underscore if you use it in
662-
[the `copier.yml` file](#the-copieryml-file)**.
661+
Remember that **the key must be prefixed with an underscore if you use it in [the
662+
`copier.yml` file][the-copieryml-file]**.
663663

664664
### `answers_file`
665665

@@ -675,7 +675,7 @@ the project root.
675675
Remember to add that file to your Git template if you want to support
676676
[updates](updating.md).
677677

678-
Don't forget to read [the docs about the answers file](#the-copier-answersyml-file).
678+
Don't forget to read [the docs about the answers file][the-copier-answersyml-file].
679679

680680
!!! example
681681

@@ -691,7 +691,7 @@ Don't forget to read [the docs about the answers file](#the-copier-answersyml-fi
691691
- Default value: `True`
692692

693693
When Copier creates the destination path, if there's any failure when rendering the
694-
template (either in the rendering process or when running the [tasks](#tasks)), Copier
694+
template (either in the rendering process or when running the [tasks][tasks]), Copier
695695
will delete that folder.
696696

697697
Copier will never delete the folder if it didn't create it. For this reason, when
@@ -806,7 +806,7 @@ to know available options.
806806
- Default value:
807807
`["copier.yaml", "copier.yml", "~*", "*.py[co]", "__pycache__", ".git", ".DS_Store", ".svn"]`
808808

809-
[Patterns](#patterns-syntax) for files/folders that must not be copied.
809+
[Patterns][patterns-syntax] for files/folders that must not be copied.
810810

811811
The CLI option can be passed several times to add several patterns.
812812

@@ -827,7 +827,7 @@ The CLI option can be passed several times to add several patterns.
827827

828828
!!! info
829829

830-
When the [`subdirectory`](#subdirectory) parameter is defined and its value is the
830+
When the [`subdirectory`][subdirectory] parameter is defined and its value is the
831831
path of an actual subdirectory (i.e. not `""` or `"."` or `"./"`), then the default
832832
value of the `exclude` parameter is `[]`.
833833

@@ -853,8 +853,8 @@ The CLI option can be passed several times to add several patterns.
853853

854854
Overwrite files that already exist, without asking.
855855

856-
Also don't ask questions to the user; just use default values
857-
[obtained from other sources](#configuration-sources).
856+
Also don't ask questions to the user; just use default values [obtained from other
857+
sources][configuration-sources].
858858

859859
!!! info
860860

@@ -871,7 +871,7 @@ Use default answers to questions.
871871
!!! attention
872872

873873
Any question that does not have a default value must be answered
874-
[via CLI/API](#data). Otherwise, an error is raised.
874+
[via CLI/API][data]. Otherwise, an error is raised.
875875

876876
!!! info
877877

@@ -885,7 +885,7 @@ Use default answers to questions.
885885

886886
Overwrite files that already exist, without asking.
887887

888-
[obtained from other sources](#configuration-sources).
888+
[obtained from other sources][configuration-sources].
889889

890890
!!! info
891891

@@ -977,7 +977,7 @@ on them, so they are always installed when Copier is installed.
977977
enhances the extension loading mechanism to allow templates writers to put their
978978
extensions directly in their templates. It also allows to modify the rendering context
979979
(the Jinja variables that you can use in your templates) before
980-
rendering templates, see [using a context hook](faq.md#how-can-i-alter-the-context-before-rendering-the-project).
980+
rendering templates, see [using a context hook][how-can-i-alter-the-context-before-rendering-the-project].
981981
- [`jinja_markdown.MarkdownExtension`](https://github.com/jpsca/jinja-markdown):
982982
provides a `markdown` tag that will render Markdown to HTML using
983983
[PyMdown extensions](https://facelessuser.github.io/pymdown-extensions/).
@@ -1001,13 +1001,13 @@ on them, so they are always installed when Copier is installed.
10011001
- Default value: `""`
10021002

10031003
A message to be printed after [generating](generating.md) or
1004-
[regenerating](generating.md#regenerating-a-project) a project _successfully_.
1004+
[regenerating][regenerating-a-project] a project _successfully_.
10051005

10061006
If the message contains Jinja code, it will be rendered with the same context as the
1007-
rest of the template. A [Jinja include](#importing-jinja-templates-and-macros)
1008-
expression may be used to import a message from a file.
1007+
rest of the template. A [Jinja include][importing-jinja-templates-and-macros] expression
1008+
may be used to import a message from a file.
10091009

1010-
The message is suppressed when Copier is run in [quiet mode](#quiet).
1010+
The message is suppressed when Copier is run in [quiet mode][quiet].
10111011

10121012
!!! example
10131013

@@ -1034,9 +1034,8 @@ The message is suppressed when Copier is run in [quiet mode](#quiet).
10341034
- CLI flags: N/A
10351035
- Default value: `""`
10361036

1037-
Like [`message_after_copy`](#message_after_copy) but printed _before_
1038-
[generating](generating.md) or [regenerating](generating.md#regenerating-a-project) a
1039-
project.
1037+
Like [`message_after_copy`][message_after_copy] but printed _before_
1038+
[generating](generating.md) or [regenerating][regenerating-a-project] a project.
10401039

10411040
!!! example
10421041

@@ -1058,7 +1057,7 @@ project.
10581057
- CLI flags: N/A
10591058
- Default value: `[]`
10601059

1061-
Migrations are like [tasks](#tasks), but each item in the list is a `dict` with these
1060+
Migrations are like [tasks][tasks], but each item in the list is a `dict` with these
10621061
keys:
10631062

10641063
- **version**: Indicates the version that the template update has to go through to
@@ -1175,8 +1174,8 @@ Suppress status output.
11751174
- Default value: `[]`
11761175

11771176
Question variables to mark as secret questions. This is especially useful when questions
1178-
are provided in the [simplified prompt format](#questions). It's equivalent to
1179-
configuring `secret: true` in the [advanced prompt format](#advanced-prompt-formatting).
1177+
are provided in the [simplified prompt format][questions]. It's equivalent to
1178+
configuring `secret: true` in the [advanced prompt format][advanced-prompt-formatting].
11801179

11811180
!!! example
11821181

@@ -1194,7 +1193,7 @@ configuring `secret: true` in the [advanced prompt format](#advanced-prompt-form
11941193
- CLI flags: `-s`, `--skip`
11951194
- Default value: `[]`
11961195

1197-
[Patterns](#patterns-syntax) for files/folders that must be skipped if they already
1196+
[Patterns][patterns-syntax] for files/folders that must be skipped if they already
11981197
exist.
11991198

12001199
!!! example
@@ -1349,7 +1348,7 @@ Suffix that instructs which files are to be processed by Jinja as templates.
13491348
```
13501349

13511350
An empty suffix is also valid, and will instruct Copier to copy and render _every file_,
1352-
except those that are [excluded by default](#exclude). If an error happens while trying
1351+
except those that are [excluded by default][exclude]. If an error happens while trying
13531352
to read a file as a template, it will fallback to a simple copy (it will typically
13541353
happen for binary files like images). At the contrary, if such an error happens and the
13551354
templates suffix is _not_ empty, Copier will abort and print an error message.
@@ -1378,9 +1377,9 @@ templates suffix is _not_ empty, Copier will abort and print an error message.
13781377

13791378
Copier templates can use dangerous features that allow arbitrary code execution:
13801379

1381-
- [Jinja extensions](#jinja_extensions)
1382-
- [Migrations](#migrations)
1383-
- [Tasks](#tasks)
1380+
- [Jinja extensions][jinja_extensions]
1381+
- [Migrations][migrations]
1382+
- [Tasks][tasks]
13841383

13851384
Therefore, these features are disabled by default and Copier will raise an error (and
13861385
exit from the CLI with code `2`) when they are found in a template. In this case, please
@@ -1463,18 +1462,19 @@ _exclude:
14631462
## The `.copier-answers.yml` file
14641463

14651464
If the destination path exists and a `.copier-answers.yml` file is present there, it
1466-
will be used to load the last user's answers to the questions made in
1467-
[the `copier.yml` file](#the-copieryml-file).
1465+
will be used to load the last user's answers to the questions made in [the `copier.yml`
1466+
file][the-copieryml-file].
14681467

14691468
This makes projects easier to update because when the user is asked, the default answers
14701469
will be the last ones they used.
14711470

14721471
The file **must be called exactly `{{ _copier_conf.answers_file }}.jinja`** (or ended
1473-
with [your chosen suffix](#templates_suffix)) in your template's root folder) to allow
1474-
[applying multiple templates to the same subproject](#applying-multiple-templates-to-the-same-subproject).
1472+
with [your chosen suffix][templates_suffix]) in your template's root folder) to allow
1473+
[applying multiple templates to the same
1474+
subproject][applying-multiple-templates-to-the-same-subproject].
14751475

1476-
The default name will be `.copier-answers.yml`, but
1477-
[you can define a different default path for this file](#answers_file).
1476+
The default name will be `.copier-answers.yml`, but [you can define a different default
1477+
path for this file][answers_file].
14781478

14791479
The file must have this content:
14801480

@@ -1486,11 +1486,11 @@ The file must have this content:
14861486
!!! important
14871487

14881488
Did you notice that `NEVER EDIT MANUALLY` part?
1489-
[It is important](updating.md#never-change-the-answers-file-manually).
1489+
[It is important][never-change-the-answers-file-manually].
14901490

14911491
The builtin `_copier_answers` variable includes all data needed to smooth future updates
14921492
of this project. This includes (but is not limited to) all JSON-serializable values
1493-
declared as user questions in [the `copier.yml` file](#the-copieryml-file).
1493+
declared as user questions in [the `copier.yml` file][the-copieryml-file].
14941494

14951495
As you can see, you also have the power to customize what will be logged here. Keys that
14961496
start with an underscore (`_`) are specific to Copier. Other keys should match questions
@@ -1524,9 +1524,9 @@ All 3 templates are completely independent:
15241524
matter their pre-commit configuration or the framework they rely on.
15251525

15261526
Well, don't worry. Copier has you covered. You just need to use a different answers file
1527-
for each one. All of them contain a `{{ _copier_conf.answers_file }}.jinja` file
1528-
[as specified above](#the-copier-answersyml-file). Then you apply all the templates to
1529-
the same project:
1527+
for each one. All of them contain a `{{ _copier_conf.answers_file }}.jinja` file [as
1528+
specified above][the-copier-answersyml-file]. Then you apply all the templates to the
1529+
same project:
15301530

15311531
```shell
15321532
mkdir my-project

docs/creating.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
A template is a directory: usually the root folder of a Git repository.
44

55
The content of the files inside the project template is copied to the destination
6-
without changes, **unless they end with `.jinja`** (or
7-
[your chosen suffix](configuring.md#templates_suffix)). In that case, the templating
8-
engine will be used to render them.
6+
without changes, **unless they end with `.jinja`** (or [your chosen
7+
suffix][templates_suffix]). In that case, the templating engine will be used to render
8+
them.
99

1010
Jinja2 templating is used. Learn more about it by reading
1111
[Jinja2 documentation](https://jinja.palletsprojects.com/).
@@ -84,7 +84,7 @@ Copier includes:
8484
context.
8585

8686
- `_copier_answers` includes the current answers dict, but slightly modified to make
87-
it suitable to [autoupdate your project safely](configuring.md#the-answers-file):
87+
it suitable to [autoupdate your project safely][the-copier-answersyml-file]:
8888
- It doesn't contain secret answers.
8989
- It doesn't contain any data that is not easy to render to JSON or YAML.
9090
- It contains special keys like `_commit` and `_src_path`, indicating how the last

docs/faq.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## Can Copier be applied over a preexisting project?
44

55
Yes, of course. Copier understands this use case out of the box. That's actually what
6-
powers features such as [updating](updating.md) or the ability of
7-
[applying multiple templates to the same subproject](configuring.md#applying-multiple-templates-to-the-same-subproject).
6+
powers features such as [updating](updating.md) or the ability of [applying multiple
7+
templates to the same subproject][applying-multiple-templates-to-the-same-subproject].
88

99
!!! example
1010

@@ -56,8 +56,8 @@ templates, so that you can add, change or remove variables.
5656
https://github.com/copier-org/copier-templates-extensions#context-hook-extension
5757

5858
In order for Copier to be able to load and use the extension when generating a project,
59-
it must be installed alongside Copier itself. More details in the
60-
[`jinja_extensions` docs](configuring.md#jinja_extensions).
59+
it must be installed alongside Copier itself. More details in the [`jinja_extensions`
60+
docs][jinja_extensions].
6161

6262
You can then configure your Jinja extensions in Copier's configuration file:
6363

@@ -144,9 +144,9 @@ repository.
144144

145145
## While developing, why the template doesn't include dirty changes?
146146

147-
Copier follows [a specific algorithm](configuring.md#templates-versions) to choose what
148-
reference to use from the template. It also
149-
[includes dirty changes in the `HEAD` ref while developing locally](configuring.md#copying-dirty-changes).
147+
Copier follows [a specific algorithm][templates-versions] to choose what reference to
148+
use from the template. It also [includes dirty changes in the `HEAD` ref while
149+
developing locally][copying-dirty-changes].
150150

151151
However, did you make sure you are selecting the `HEAD` ref for copying?
152152

docs/generating.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ modifications made, Copier will use this modified working copy of the template t
4848
development of new template features.
4949

5050
If you would like to override the version of template being installed, the
51-
[`--vcs-ref`](configuring.md/#vcs_ref) argument can be used to specify a branch, tag or
52-
other reference to use.
51+
[`--vcs-ref`][vcs_ref] argument can be used to specify a branch, tag or other reference
52+
to use.
5353

5454
For example to use the latest master branch from a public repository:
5555

0 commit comments

Comments
 (0)