In my DocumenterInterLinks
package, I would like to add a specific feature that is compatible only with Documenter >= 1.3.0
. Generally, the package is compatible with Documenter >= 1.0.0
, and I’d like to keep it that way.
In order to handle this, I’ve added the following to my main package file:
if Documenter.DOCUMENTER_VERSION >= v"1.3.0-dev"
include("fallback.jl")
else
include("fallback_not_available.jl")
end
Here, fallback.jl
contains the feature, and fallback_not_available.jl
contains stumps that gracefully generate “feature not available” warnings for the older versions of Documenter
. (And “fallback” is the name of the feature; sorry that name might be a bit confusing in this context)
It might be relevant that fallback.jl
imports objects from Documenter
that only exist in Documenter > 1.3
.
Is “include
depending on the version of the dependency” a good pattern for a situation like this?
Are there any conceivable problems with pre-compilation etc. that might make this inadvisable? The @static
macro wouldn’t really do anything here, right?
Any alternative ideas?