mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-09 12:06:05 +01:00
docs/lib: simplify default title-heading
This commit is contained in:
parent
4414d8aa14
commit
c146f6e09c
2 changed files with 11 additions and 14 deletions
|
|
@ -100,22 +100,19 @@ let
|
||||||
> functions.md
|
> functions.md
|
||||||
fi
|
fi
|
||||||
|
|
||||||
default_heading="# $name"
|
print_title=true
|
||||||
if [[ -n "$title" ]]; then
|
|
||||||
default_heading+=": $title"
|
|
||||||
fi
|
|
||||||
|
|
||||||
print_heading=true
|
|
||||||
if [[ -f "$md_file" ]] && [[ "$(head --lines 1 "$md_file")" == '# '* ]]; then
|
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\"."
|
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"
|
>&2 echo " Found \"$(head --lines 1 "$md_file")\" in: $md_file"
|
||||||
print_heading=false
|
fi
|
||||||
|
print_title=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $(dirname "$out_file")
|
mkdir -p $(dirname "$out_file")
|
||||||
(
|
(
|
||||||
if [[ "$print_heading" = true ]]; then
|
if [[ "$print_title" = true ]]; then
|
||||||
echo "$default_heading"
|
echo "# $title"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
if [[ -f "$md_file" ]]; then
|
if [[ -f "$md_file" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@
|
||||||
{
|
{
|
||||||
lib.nixvim = {
|
lib.nixvim = {
|
||||||
_page = {
|
_page = {
|
||||||
title = "Nixvim's functions";
|
title = "lib.nixvim: Nixvim's functions";
|
||||||
source = ./index.md;
|
source = ./index.md;
|
||||||
};
|
};
|
||||||
|
|
||||||
utils._page = {
|
utils._page = {
|
||||||
title = "utility functions";
|
title = "lib.nixvim.utils: utility functions";
|
||||||
functions.file = ../../lib/utils.nix;
|
functions.file = ../../lib/utils.nix;
|
||||||
};
|
};
|
||||||
lua._page = {
|
lua._page = {
|
||||||
title = "lua functions";
|
title = "lib.nixvim.lua: lua functions";
|
||||||
functions.file = ../../lib/to-lua.nix;
|
functions.file = ../../lib/to-lua.nix;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue