Skip to content

Commit c146f6e

Browse files
committed
docs/lib: simplify default title-heading
1 parent 4414d8a commit c146f6e

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

docs/lib/default.nix

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,19 @@ let
100100
> functions.md
101101
fi
102102
103-
default_heading="# $name"
104-
if [[ -n "$title" ]]; then
105-
default_heading+=": $title"
106-
fi
107-
108-
print_heading=true
103+
print_title=true
109104
if [[ -f "$md_file" ]] && [[ "$(head --lines 1 "$md_file")" == '# '* ]]; then
110-
>&2 echo "NOTE: markdown file for $name starts with a <h1> heading. Skipping default heading \"$default_heading\"."
111-
>&2 echo " Found \"$(head --lines 1 "$md_file")\" in: $md_file"
112-
print_heading=false
105+
if [[ -n "$title" ]]; then
106+
>&2 echo "NOTE: markdown file for $name starts with a <h1> heading. Skipping title \"$title\"."
107+
>&2 echo " Found \"$(head --lines 1 "$md_file")\" in: $md_file"
108+
fi
109+
print_title=false
113110
fi
114111
115112
mkdir -p $(dirname "$out_file")
116113
(
117-
if [[ "$print_heading" = true ]]; then
118-
echo "$default_heading"
114+
if [[ "$print_title" = true ]]; then
115+
echo "# $title"
119116
echo
120117
fi
121118
if [[ -f "$md_file" ]]; then

docs/lib/pages.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
{
77
lib.nixvim = {
88
_page = {
9-
title = "Nixvim's functions";
9+
title = "lib.nixvim: Nixvim's functions";
1010
source = ./index.md;
1111
};
1212

1313
utils._page = {
14-
title = "utility functions";
14+
title = "lib.nixvim.utils: utility functions";
1515
functions.file = ../../lib/utils.nix;
1616
};
1717
lua._page = {
18-
title = "lua functions";
18+
title = "lib.nixvim.lua: lua functions";
1919
functions.file = ../../lib/to-lua.nix;
2020
};
2121
};

0 commit comments

Comments
 (0)