mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-15 21:41:11 +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
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue