|
2 | 2 |
|
3 | 3 | Filter to include other files in the document. |
4 | 4 |
|
5 | | -## Prerquisites |
| 5 | +## Note |
6 | 6 |
|
7 | | -This filter needs to be executed before most other filters. Any |
8 | | -filter that runs before this will only see the empty codeblocks. |
| 7 | +Do not run other filters before executing `include-files`, unless you are |
| 8 | +certain the other filter does not require `include-files` to function properly. |
| 9 | +Executing most filters without first using `include-files` will result in the |
| 10 | +other filter seeing an empty code block. |
9 | 11 |
|
10 | 12 | ## Usage |
11 | 13 |
|
12 | | -Use a special code block with class `include` to include files of |
13 | | -the same format as the input. Each code line is treated as the |
14 | | -filename of a file, parsed, and the result is added to the |
15 | | -document. |
| 14 | +Use a special code block with class `include` to include files of the same |
| 15 | +format as the input. Each code line is treated as the filename of a file, |
| 16 | +parsed, and the result is added to the document. |
16 | 17 |
|
17 | 18 | Metadata from included files is discarded. |
18 | 19 |
|
19 | 20 | ### Shifting Headings |
20 | 21 |
|
21 | | -The default is to include the subdocuments unchanged, but it can |
22 | | -be convenient to modify the level of headers; a top-level header |
23 | | -in an included file should be a second or third-level header in |
24 | | -the final document. |
| 22 | +The default is to include the subdocuments unchanged, but it can be convenient |
| 23 | +to modify the level of headers; a top-level header in an included file should be |
| 24 | +a second or third-level header in the final document. |
25 | 25 |
|
26 | 26 | #### Manual shifting |
27 | 27 |
|
28 | | -Use the `shift-heading-level-by` attribute to control header |
29 | | -shifting. |
| 28 | +Use the `shift-heading-level-by` attribute to control header shifting. |
30 | 29 |
|
31 | 30 | #### Automatic shifting |
32 | 31 |
|
@@ -54,32 +53,30 @@ file-a.md |
54 | 53 |
|
55 | 54 | ### Comments |
56 | 55 |
|
57 | | -Comment lines can be added in the include block by beginning a |
58 | | -line with two `//` characters. |
| 56 | +Comment lines can be added in the include block by beginning a line with two |
| 57 | +`//` characters. |
59 | 58 |
|
60 | 59 | ### Different formats |
61 | 60 |
|
62 | | -Files are assumed to be written in Markdown, but sometimes one |
63 | | -will want to include files written in a different format. An |
64 | | -alternative format can be specified via the `format` attribute. |
65 | | -Only plain-text formats are accepted. |
| 61 | +Files are assumed to be written in Markdown, but sometimes one will want to |
| 62 | +include files written in a different format. An alternative format can be |
| 63 | +specified via the `format` attribute. Only plain-text formats are accepted. |
66 | 64 |
|
67 | 65 | ### Recursive transclusion |
68 | 66 |
|
69 | | -Included files can in turn include other files. Note that all |
70 | | -filenames must be relative to the directory from which they are |
71 | | -included. I.e., if a file `a/b.md` is included in the main |
72 | | -document, and another file `a/b/c.md` should be included from |
73 | | -`a/b.md`, then the relative path from `a/b.md` must be used, in |
74 | | -this case `b/c.md`. The full relative path will be automatically |
75 | | -generated in the final document. The same goes for image paths and |
76 | | -codeblock file paths using the `include-code-files` filter. |
| 67 | +Included files can in turn include other files. Note that all filenames must be |
| 68 | +relative to the directory from which they are included. I.e., if a file `a/b.md` |
| 69 | +is included in the main document, and another file `a/b/c.md` should be included |
| 70 | +from `a/b.md`, then the relative path from `a/b.md` must be used, in this case |
| 71 | +`b/c.md`. The full relative path will be automatically generated in the final |
| 72 | +document. The same goes for image paths and codeblock file paths using the |
| 73 | +`include-code-files` filter. |
77 | 74 |
|
78 | 75 | ## Example |
79 | 76 |
|
80 | | -Let's assume we are writing a longer document, like a thesis. |
81 | | -Each chapter and appendix section resides in its own file, with |
82 | | -some additional information in the main file `main.md`: |
| 77 | +Let's assume we are writing a longer document, like a thesis. Each chapter and |
| 78 | +appendix section resides in its own file, with some additional information in |
| 79 | +the main file `main.md`: |
83 | 80 |
|
84 | 81 | --- |
85 | 82 | author: me |
|
0 commit comments