You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37-11Lines changed: 37 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ preprocessors:
26
26
- includes:
27
27
cache_dir: !path .includescache
28
28
recursive: true
29
+
stub_text: true
29
30
extensions:
30
31
- md
31
32
- j2
@@ -43,8 +44,18 @@ preprocessors:
43
44
`recursive`
44
45
: Flag that defines whether includes in included documents should be processed.
45
46
47
+
`stub_text`
48
+
: Flag that defines whether to insert an error message about adding content from the included file into the text of the document.
49
+
Default `true`.
50
+
51
+
`allow_failure`
52
+
: Flag that defines whether to raise warnings instead of errors.
53
+
Default `true`.
54
+
46
55
`extensions`
47
-
: List of file extensions that defines the types of files which should be processed looking for include statements. Might be useful if you need to include some content from third-party sources into non-Markdown files like configs, templates, reports, etc. Defaults to `[md]`.
56
+
: List of file extensions that defines the types of files which should be processed looking for include statements.
57
+
Might be useful if you need to include some content from third-party sources into non-Markdown files like configs, templates, reports, etc.
58
+
Defaults to `[md]`.
48
59
49
60
`aliases`
50
61
: Mapping from aliases to Git repository URLs. Once defined here, an alias can be used to refer to the repository instead of its full URL.
@@ -74,11 +85,13 @@ The preprocessor allows two syntax variants for include statements.
74
85
75
86
The **legacy** syntax is simpler and shorter but less flexible. There are no plans to extend it.
76
87
77
-
The **new** syntax introduced in version 1.1.0 is stricter and more flexible. It is more suitable for complex cases, and it can be easily extended in the future. This is the preferred syntax.
88
+
The **new** syntax introduced in version 1.1.0 is stricter and more flexible.
89
+
It is more suitable for complex cases, and it can be easily extended in the future. This is the preferred syntax.
78
90
79
91
Both variants of syntax use the `<include>...</include>` tags.
80
92
81
-
If the included file is specified between the tags, it’s the legacy syntax. If the file is referenced in the tag attributes (`src`, `repo_url`, `path`), it’s the new one.
93
+
If the included file is specified between the tags, it’s the legacy syntax.
94
+
If the file is referenced in the tag attributes (`src`, `repo_url`, `path`), it’s the new one.
: Full content of the ending heading when it’s necessary to include some part of the referenced file content. *The referenced heading will not be included.*
178
191
179
192
`from_id`
180
-
: ID of the starting heading or starting anchor when it’s necessary to include some part of the referenced file content. The `from_id` attribute has higher priority than `from_heading`. If the `to_heading`, `to_id`, or `to_end` attribute is not specified, the preprocessor cuts the included content to the next heading of the same level. *The referenced id is included.*
193
+
: ID of the starting heading or starting anchor when it’s necessary to include some part of the referenced file content.
194
+
The `from_id` attribute has higher priority than `from_heading`. If the `to_heading`, `to_id`, or `to_end` attribute is not specified, the preprocessor cuts the included content to the next heading of the same level.
195
+
*The referenced id is included.*
181
196
182
197
> **NOTE:** If you want `from_id` and `to_id` features to work with [anchors](https://foliant-docs.github.io/docs/preprocessors/anchors/), make sure that anchors preprocessor is listed *after* includes in foliant.yml.
183
198
184
199
`to_id`
185
-
: ID of the ending heading or ending anchor when it’s necessary to include some part of the referenced file content. The `to_id` attribute has higher priority than `to_heading`. *The referenced id will not be included.*
200
+
: ID of the ending heading or ending anchor when it’s necessary to include some part of the referenced file content.
201
+
The `to_id` attribute has higher priority than `to_heading`. *The referenced id will not be included.*
186
202
187
203
`to_end`
188
-
: Flag that tells the preprocessor to cut to the end of the included content. Otherwise, if `from_heading` or `from_id` is specified, the preprocessor cuts the included content to the next heading of the same level as the starting heading, or the heading that precedes the starting anchor.
204
+
: Flag that tells the preprocessor to cut to the end of the included content.
205
+
Otherwise, if `from_heading` or `from_id` is specified, the preprocessor cuts the included content to the next heading of the same level as the starting heading, or the heading that precedes the starting anchor.
Here `Some Heading {#custom_id}` is the full content of the heading, `custom_id` is its ID, and `one_more_custom_id` is the ID of the anchor.
197
214
198
215
`wrap_code`
199
-
: Attribute that allows to mark up the included content as fence code block or inline code by wrapping the content with additional Markdown syntax constructions. Available values are: `triple_backticks`—to add triple backticks separated with newlines before and after the included content; `triple_tildas`—to do the same but using triple tildas; `single_backticks`—to add single backticks before and after the included content without adding extra newlines. Note that this attribute doesn’t affect the included content. So if the content consists of multiple lines, and the `wrap_code` attribute with the value `single_backticks` is set, all newlines within the content will be kept. To perform forced conversion of multiple lines into one, use the `inline` attribute.
216
+
: Attribute that allows to mark up the included content as fence code block or inline code by wrapping the content with additional Markdown syntax constructions.
217
+
Available values are: `triple_backticks`—to add triple backticks separated with newlines before and after the included content; `triple_tildas`—to do the same but using triple tildas; `single_backticks`—to add single backticks before and after the included content without adding extra newlines.
218
+
Note that this attribute doesn’t affect the included content. So if the content consists of multiple lines, and the `wrap_code` attribute with the value `single_backticks` is set, all newlines within the content will be kept.
219
+
To perform forced conversion of multiple lines into one, use the `inline` attribute.
200
220
201
221
`code_language`
202
-
: Language of the included code snippet that should be additionally marked up as fence code block by using the `wrap_code` attribute with the value `triple_backticks` or `triple_tildas`. Note that the `code_language` attribute doesn’t take effect to inline code that is obtained when the `single_backticks` value is used. The value of this attribute should be a string without whitespace characters, usually in lowercase; examples: `python`, `bash`, `json`.
222
+
: Language of the included code snippet that should be additionally marked up as fence code block by using the `wrap_code` attribute with the value `triple_backticks` or `triple_tildas`.
223
+
Note that the `code_language` attribute doesn’t take effect to inline code that is obtained when the `single_backticks` value is used.
224
+
The value of this attribute should be a string without whitespace characters, usually in lowercase; examples: `python`, `bash`, `json`.
203
225
204
226
### Optional Attributes Supported in Both Syntax Variants
By default, the starting heading is included to the output, and the ending heading is not. Starting and ending anchors are never included into the output.
225
247
226
248
`inline`
227
-
: Flag that tells the preprocessor to replace sequences of whitespace characters of many kinds (including `\r`, `\n`, and `\t`) with single spaces (` `) in the included content, and then to strip leading and trailing spaces. It may be useful in single-line table cells. Default value is `false`.
249
+
: Flag that tells the preprocessor to replace sequences of whitespace characters of many kinds (including `\r`, `\n`, and `\t`) with single spaces (` `) in the included content, and then to strip leading and trailing spaces.
250
+
It may be useful in single-line table cells. Default value is `false`.
228
251
229
252
`project_root`
230
253
: Path to the top-level (“root”) directory of Foliant project that the included file belongs to. This option may be needed to resolve the `!path` and `!project_path` modifiers in the included content properly.
@@ -243,9 +266,12 @@ Different options can be combined. For example, use both `sethead` and `nohead`
243
266
244
267
### The Legacy Syntax
245
268
246
-
This syntax was the only supported in the preprocessor up to version 1.0.11. It’s weird and cryptic, you had to memorize strange rules about `$`, `#` and stuff. The new syntax described above is much cleaner.
269
+
This syntax was the only supported in the preprocessor up to version 1.0.11.
270
+
It’s weird and cryptic, you had to memorize strange rules about `$`, `#` and stuff.
271
+
The new syntax described above is much cleaner.
247
272
248
-
The legacy syntax is kept for backward compatibility. To use it, put the reference to the included file between `<include>...</include>` tags.
273
+
The legacy syntax is kept for backward compatibility.
274
+
To use it, put the reference to the included file between `<include>...</include>` tags.
0 commit comments