Documenter.jl: @autodocs for specific source files

From Documenter.jl’s documentation of @autodocs:

[…], a Pages vector may be included in @autodocs to filter
docstrings based on the source file in which they are defined:

```@autodocs
Modules = [Foo]
Pages   = ["a.jl", "b.jl"]
```

However, it also says

Note that page matching is done using the end of the provided strings
and so a.jl will be matched by any source file that ends in a.jl, i.e.
src/a.jl or src/foo/a.jl.

How can I restrict the @autodocs block to specific source files?

My package’s source code is organized as

src/
    foo/a.jl
    foo/b.jl
    ignore/a.jl
    ignore/b.jl
    other.jl

How to make the @autodocs block only consider files src/foo/a.jl and src/foo/b.jl but not src/ignore/a.jl and src/ignore/b.jl?

Unfortunately, Pages = ["foo/a.jl", "foo/b.jl"] didn’t do it for me.

Thanks in advance.

x-ref: https://stackoverflow.com/questions/48587995/documenter-jl-autodocs-for-specific-source-files
x-ref: https://github.com/JuliaDocs/Documenter.jl/issues/630

1 Like

Found https://github.com/JuliaDocs/Documenter.jl/blob/master/src/Expanders.jl#L353,

for p in pages
    if endswith(path, p)

This should at least be true for Pages = ["foo/a.jl", "foo/b.jl"]. Still, it doesn’t work for me.

Turns out that this is a Windows issue due to absence of normalization of path separators (see linked github issue).

On Linux Pages = ["foo/a.jl", "foo/b.jl"] should work.

On Windows Pages = ["foo\\a.jl", "foo\\b.jl"] should work.