docs: include function docs

Embed the function reference docs into the main docs website.
This commit is contained in:
Matt Sturgeon 2025-05-15 14:24:55 +01:00
parent dfaea5982e
commit 1c6dd6579a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 16 additions and 1 deletions

View file

@ -127,7 +127,7 @@ lib.fix (
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
docs = pkgs.callPackage ./mdbook {
inherit evaledModules transformOptions;
inherit (self) search;
inherit (self) search lib-docs;
};
}
)

View file

@ -10,6 +10,10 @@
- [Configuration examples](./user-guide/config-examples.md)
- [Lazy Loading](./user-guide/lazy-loading.md)
# Functions
@FUNCTIONS_MENU@
# Platforms
- [Nixvim Platforms](./platforms/index.md)

View file

@ -7,6 +7,7 @@
nixosOptionsDoc,
transformOptions,
search,
lib-docs,
# The root directory of the site
baseHref ? "/",
# A list of all available docs that should be linked to
@ -359,6 +360,13 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
# Copy the contributing file
cp $contributing ./CONTRIBUTING.md
# Symlink the function docs
for path in ${lib-docs}/*
do
echo "symlinking \"$path\" to \"$(basename "$path")\""
ln -s "$path" $(basename "$path")
done
# Copy the generated MD docs into the build directory
bash -e ${finalAttrs.passthru.copy-docs}
@ -375,6 +383,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
# Patch SUMMARY.md - which defiens mdBook's table of contents
substituteInPlace ./SUMMARY.md \
--replace-fail "@FUNCTIONS_MENU@" "$functionsSummary" \
--replace-fail "@PLATFORM_OPTIONS@" "$wrapperOptionsSummary" \
--replace-fail "@NIXVIM_OPTIONS@" "$nixvimOptionsSummary"
@ -401,6 +410,8 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
wrapperOptionsFiles
;
functionsSummary = lib-docs.menu;
passthru = {
fix-links = callPackage ../fix-links {
# FIXME: determine values from availableVersions & baseHref