Skip to content

Remote page #72

Open
Open
@johnnychen94

Description

@johnnychen94

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 clone https://github.com/JuliaImages/ImageFiltering.jl.git and collect the whole docs/src folder as one section filter in src/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:

  1. when DemoPage("src/pkg") notices the existence of remote pages/sections, it will immediately clone those repo into docs/.democards folder, and then generate a LocalRemote placeholder for it.
  2. generate(::LocalRemote) would copy the contents at runtime, doing normal generation, and deleting the copied contents to restore the original folder structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions