@@ -13,32 +13,32 @@ It is important that you understand how Copier works. It has 2 kinds of configur
13
13
Copier reads ** settings** from these sources, in this order of priority:
14
14
15
15
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
17
17
underscore (e.g. ` _min_copier_version ` ).
18
18
19
19
!!! info
20
20
21
21
Some settings are _only_ available as CLI arguments, and some others _only_ as
22
22
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] .
24
24
25
25
Copier obtains ** answers** from these sources, in this order of priority:
26
26
27
27
1 . Command line or API arguments.
28
28
1 . Asking the user. Notice that Copier will not ask any questions answered in the
29
29
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 ] .
32
32
33
33
## The ` copier.yml ` file
34
34
35
35
The ` copier.yml ` (or ` copier.yaml ` ) file is found in the root of the template, and it is
36
36
the main entrypoint for managing your template configuration. It will be read and used
37
37
for two purposes:
38
38
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.).
42
42
43
43
### Questions
44
44
@@ -156,7 +156,7 @@ Supported keys:
156
156
long, you can use
157
157
[ YAML anchors] ( https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html ) .
158
158
- ** 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
160
160
` true ` , a default value is required.
161
161
- ** placeholder** : To provide a visual example for what would be a good value. It is
162
162
only shown while the answer is empty, so maybe it doesn't make much sense to provide
@@ -455,12 +455,12 @@ your_template
455
455
456
456
!!! important
457
457
458
- Note that the chosen [template suffix](# templates_suffix)
458
+ Note that the chosen [template suffix][ templates_suffix]
459
459
**must** appear outside of the Jinja condition,
460
460
otherwise the whole file won't be considered a template and will
461
461
be copied as such in generated projects.
462
462
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] :
464
464
465
465
` ` ` yaml title="copier.yml"
466
466
ci:
@@ -483,7 +483,7 @@ your_template
483
483
484
484
!!! important
485
485
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] .
487
487
488
488
!!! warning
489
489
@@ -627,14 +627,14 @@ your_template
627
627
...
628
628
` ` `
629
629
630
- Then, make sure to [exclude](# exclude) this folder
630
+ Then, make sure to [exclude][ exclude] this folder
631
631
632
632
` ` ` yaml title="copier.yml"
633
633
_exclude:
634
634
- includes
635
635
` ` `
636
636
637
- or use a [subdirectory](# subdirectory) , e.g.:
637
+ or use a [subdirectory][ subdirectory] , e.g. :
638
638
639
639
` ` ` yaml title="copier.yml"
640
640
_subdirectory: template
@@ -655,11 +655,11 @@ reason, Copier provides a function
655
655
656
656
# # Available settings
657
657
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] .
660
660
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] **.
663
663
664
664
# ## `answers_file`
665
665
@@ -675,7 +675,7 @@ the project root.
675
675
Remember to add that file to your Git template if you want to support
676
676
[updates](updating.md).
677
677
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] .
679
679
680
680
!!! example
681
681
@@ -691,7 +691,7 @@ Don't forget to read [the docs about the answers file](#the-copier-answersyml-fi
691
691
- Default value : ` True`
692
692
693
693
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
695
695
will delete that folder.
696
696
697
697
Copier will never delete the folder if it didn't create it. For this reason, when
@@ -806,7 +806,7 @@ to know available options.
806
806
- Default value :
807
807
` ["copier.yaml", "copier.yml", "~*", "*.py[co]", "__pycache__", ".git", ".DS_Store", ".svn"]`
808
808
809
- [Patterns](# patterns-syntax) for files/folders that must not be copied.
809
+ [Patterns][ patterns-syntax] for files/folders that must not be copied.
810
810
811
811
The CLI option can be passed several times to add several patterns.
812
812
@@ -827,7 +827,7 @@ The CLI option can be passed several times to add several patterns.
827
827
828
828
!!! info
829
829
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
831
831
path of an actual subdirectory (i.e. not `""` or `"."` or `"./"`), then the default
832
832
value of the `exclude` parameter is `[]`.
833
833
@@ -853,8 +853,8 @@ The CLI option can be passed several times to add several patterns.
853
853
854
854
Overwrite files that already exist, without asking.
855
855
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] .
858
858
859
859
!!! info
860
860
@@ -871,7 +871,7 @@ Use default answers to questions.
871
871
!!! attention
872
872
873
873
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.
875
875
876
876
!!! info
877
877
@@ -885,7 +885,7 @@ Use default answers to questions.
885
885
886
886
Overwrite files that already exist, without asking.
887
887
888
- [obtained from other sources](# configuration-sources) .
888
+ [obtained from other sources][ configuration-sources] .
889
889
890
890
!!! info
891
891
@@ -977,7 +977,7 @@ on them, so they are always installed when Copier is installed.
977
977
enhances the extension loading mechanism to allow templates writers to put their
978
978
extensions directly in their templates. It also allows to modify the rendering context
979
979
(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] .
981
981
- [`jinja_markdown.MarkdownExtension`](https://github.com/jpsca/jinja-markdown) :
982
982
provides a `markdown` tag that will render Markdown to HTML using
983
983
[PyMdown extensions](https://facelessuser.github.io/pymdown-extensions/).
@@ -1001,13 +1001,13 @@ on them, so they are always installed when Copier is installed.
1001
1001
- Default value : ` ""`
1002
1002
1003
1003
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_.
1005
1005
1006
1006
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.
1009
1009
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] .
1011
1011
1012
1012
!!! example
1013
1013
@@ -1034,9 +1034,8 @@ The message is suppressed when Copier is run in [quiet mode](#quiet).
1034
1034
- CLI flags : N/A
1035
1035
- Default value : ` ""`
1036
1036
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.
1040
1039
1041
1040
!!! example
1042
1041
@@ -1058,7 +1057,7 @@ project.
1058
1057
- CLI flags : N/A
1059
1058
- Default value : ` []`
1060
1059
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
1062
1061
keys :
1063
1062
1064
1063
- **version**: Indicates the version that the template update has to go through to
@@ -1175,8 +1174,8 @@ Suppress status output.
1175
1174
- Default value : ` []`
1176
1175
1177
1176
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] .
1180
1179
1181
1180
!!! example
1182
1181
@@ -1194,7 +1193,7 @@ configuring `secret: true` in the [advanced prompt format](#advanced-prompt-form
1194
1193
- CLI flags : ` -s` , `--skip`
1195
1194
- Default value : ` []`
1196
1195
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
1198
1197
exist.
1199
1198
1200
1199
!!! example
@@ -1349,7 +1348,7 @@ Suffix that instructs which files are to be processed by Jinja as templates.
1349
1348
` ` `
1350
1349
1351
1350
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
1353
1352
to read a file as a template, it will fallback to a simple copy (it will typically
1354
1353
happen for binary files like images). At the contrary, if such an error happens and the
1355
1354
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.
1378
1377
1379
1378
Copier templates can use dangerous features that allow arbitrary code execution :
1380
1379
1381
- - [Jinja extensions](# jinja_extensions)
1382
- - [Migrations](# migrations)
1383
- - [Tasks](# tasks)
1380
+ - [Jinja extensions][ jinja_extensions]
1381
+ - [Migrations][ migrations]
1382
+ - [Tasks][ tasks]
1384
1383
1385
1384
Therefore, these features are disabled by default and Copier will raise an error (and
1386
1385
exit from the CLI with code `2`) when they are found in a template. In this case, please
@@ -1463,18 +1462,19 @@ _exclude:
1463
1462
# # The `.copier-answers.yml` file
1464
1463
1465
1464
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] .
1468
1467
1469
1468
This makes projects easier to update because when the user is asked, the default answers
1470
1469
will be the last ones they used.
1471
1470
1472
1471
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].
1475
1475
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] .
1478
1478
1479
1479
The file must have this content :
1480
1480
@@ -1486,11 +1486,11 @@ The file must have this content:
1486
1486
!!! important
1487
1487
1488
1488
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] .
1490
1490
1491
1491
The builtin `_copier_answers` variable includes all data needed to smooth future updates
1492
1492
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] .
1494
1494
1495
1495
As you can see, you also have the power to customize what will be logged here. Keys that
1496
1496
start with an underscore (`_`) are specific to Copier. Other keys should match questions
@@ -1524,9 +1524,9 @@ All 3 templates are completely independent:
1524
1524
matter their pre-commit configuration or the framework they rely on.
1525
1525
1526
1526
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 :
1530
1530
1531
1531
` ` ` shell
1532
1532
mkdir my-project
0 commit comments