### Example: Replacing `include` calls with included code
Let's say that we have some individual example files `file1, file2, ...` etc.
that are _runnable_ and also following the style of Literate. These files could be for example used in the test suite of your package.
We want to group them all into a single page in our documentation, but we
do not want to copy paste the content of `file1, ...` for robustness: the files are included in the test suite and some changes may occur to them. We want these changes to also be reflected in the documentation.
A very easy way to do this is using `preprocess` to interchange `include` statements with file content. First, create a runnable `.jl` following the format of Literate
```julia
# # Replace includes
# This is an example to replace `include` calls with the actual file content.
include("file1.jl")
# Cool, we just saw the result of the above code snippet. Here is one more:
include("file2.jl")
```
Let's say we have saved this file as `examples.jl`.
Then, you want to properly define a pre-processing function:
```julia
function replace_includes(str)
included = ["file1.jl", "file2.jl"]
# Here the path loads the files from their proper directory,
# which may not be the directory of the `examples.jl` file!
name = "markdown_file_name", preprocess = replace_includes)
```
and you will see that in the final output file (here `markdown_file_name.md`) the `include`
statements are replaced with the actual code to be included!
This approach is used for example in the documentation of the Julia package [`TimeseriesPrediction`](https://github.com/JuliaDynamics/TimeseriesPrediction.jl), see [here](https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/src/tsprediction/stexamples.jl) and [here for the generating script](https://github.com/JuliaDynamics/DynamicalSystems.jl/blob/master/docs/make.jl#L11-L29)