Description
Let's take JuliaImages as an example.
Images.jl
in JuliaImages consists of different packages, some of which (e.g., ImageFiltering
) already have their own documentation. In the meantime, there is a centralized documentation in https://juliaimages.org. It is unclear whether a centralized version or a distributed version is good.
This proposal aims to collect the distributed documentation and rebuild it in a centralized way.
This solution includes two steps:
First, configure things in config.json
. For example,
src
├── index.md
└── pkg
├── axes
├── config.json
└── segmentation
with docs/src/pkg/config.json
filled with following items:
{
"remote":{
"filter": [
"git",
"https://github.com/JuliaImages/ImageFiltering.jl.git",
"docs/src"
],
"binarization": "https://github.com/zygmuntszpak/ImageBinarization.jl.git/[docs/src]"
}
}
Two valid syntaxes can be supported here:
- the first item is a little bit verbose, it says: use
git
protocol to clonehttps://github.com/JuliaImages/ImageFiltering.jl.git
and collect the wholedocs/src
folder as one sectionfilter
insrc/pkg
. - the second item is a more compact version for
git
, which follows the subdir syntax in Pkg.jl. i.e.,pkg> add /tmp/testproject/dev/FooBar.git/[otherfolder/subfolder/Bar]
The type hierarchy for this is:
abstract AbstractRemotePath end
struct GitRemote{T} <: AbstractRemotePath
path::String
item::T
end
This type models how remote (git) repo is cloned into local folders during deployment.
Remote folders are not cloned directly into docs/src/pkg
folder because that's not friendly to folder arrangement. Instead, all remote repos are cloned into .democards
folder. This also enables repo sharing.
Because generally, DemoCards
does not allow indirect paths. Not cloneing remote folders into docs/src/pkg
requires a new type LocalRemote
to break such requirement and models runtime folder link/move/copy.
The workflow is:
- when
DemoPage("src/pkg")
notices the existence of remote pages/sections, it will immediately clone those repo intodocs/.democards
folder, and then generate aLocalRemote
placeholder for it. generate(::LocalRemote)
would copy the contents at runtime, doing normal generation, and deleting the copied contents to restore the original folder structure.