1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00

docs/lib: simplify default title-heading

This commit is contained in:
Matt Sturgeon 2025-09-23 14:50:15 +01:00
parent 4414d8aa14
commit c146f6e09c
2 changed files with 11 additions and 14 deletions

View file

@ -100,22 +100,19 @@ let
> functions.md
fi
default_heading="# $name"
if [[ -n "$title" ]]; then
default_heading+=": $title"
fi
print_heading=true
print_title=true
if [[ -f "$md_file" ]] && [[ "$(head --lines 1 "$md_file")" == '# '* ]]; then
>&2 echo "NOTE: markdown file for $name starts with a <h1> heading. Skipping default heading \"$default_heading\"."
>&2 echo " Found \"$(head --lines 1 "$md_file")\" in: $md_file"
print_heading=false
if [[ -n "$title" ]]; then
>&2 echo "NOTE: markdown file for $name starts with a <h1> heading. Skipping title \"$title\"."
>&2 echo " Found \"$(head --lines 1 "$md_file")\" in: $md_file"
fi
print_title=false
fi
mkdir -p $(dirname "$out_file")
(
if [[ "$print_heading" = true ]]; then
echo "$default_heading"
if [[ "$print_title" = true ]]; then
echo "# $title"
echo
fi
if [[ -f "$md_file" ]]; then

View file

@ -6,16 +6,16 @@
{
lib.nixvim = {
_page = {
title = "Nixvim's functions";
title = "lib.nixvim: Nixvim's functions";
source = ./index.md;
};
utils._page = {
title = "utility functions";
title = "lib.nixvim.utils: utility functions";
functions.file = ../../lib/utils.nix;
};
lua._page = {
title = "lua functions";
title = "lib.nixvim.lua: lua functions";
functions.file = ../../lib/to-lua.nix;
};
};