Skip to content

Commit 3ad106b

Browse files
committed
ci(docs): update genvimdoc github action
Updated the configuration for the vimdoc.yml github action so that it can support the multiple documentation filepaths under ./docs/*.md.
1 parent 943846c commit 3ad106b

5 files changed

Lines changed: 185 additions & 17 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
# Prevent from running on release commits
10+
# Prevent from running on release commits.
1111
skip_on_release:
1212
name: Skip on Release
1313
if: ${{ !startsWith(github.event.head_commit.message, 'chore(master)') }}

.github/workflows/vimdoc.yml

Lines changed: 111 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
# Prevent from running on release commits
10+
# Prevent from running on release commits.
1111
skip_on_release:
1212
name: Skip on Release
1313
if: ${{ !startsWith(github.event.head_commit.message, 'chore(master)') }}
@@ -16,24 +16,129 @@ jobs:
1616
- run: |
1717
exit 0
1818
19-
docs:
20-
name: Gen Vimdoc
19+
docs-build:
20+
timeout-minutes: 5
21+
runs-on: ubuntu-latest
22+
outputs:
23+
docs_matrix: ${{ steps.set-docs-matrix.outputs.docs_matrix }}
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- id: set-docs-matrix
29+
run: |
30+
# Create a JSON array of objects, each containing module, desc, and section
31+
first=true
32+
json_array="[]"
33+
docs_matrix="[]"
34+
tmpfile="$(mktemp)"
35+
trap 'rm -rf "$tmpfile"' 0 1 15
36+
37+
if [ -d "docs" ] && [ "$(ls -A docs/*.md 2>/dev/null)" ]; then
38+
find ./docs -type f -name '*.md' 2>/dev/null >"$tmpfile"
39+
while read -r file; do
40+
if [ -f "$file" ]; then
41+
module="$file"
42+
desc="$(basename "$file" .md | sed 's/-/ /g; s/[^ ]*/\u&/g')"
43+
section="$(basename "$file" .md)"
44+
45+
# Build JSON object manually
46+
json_object="{\"module\":\"$module\",\"desc\":\"$desc\",\"section\":\"$section\"}"
47+
48+
if [ "$first" = true ]; then
49+
first=false
50+
json_array="[$json_object"
51+
else
52+
json_array="$json_array,$json_object"
53+
fi
54+
fi
55+
done <"$tmpfile"
56+
57+
if [ "$first" = false ]; then
58+
json_array="$json_array]"
59+
docs_matrix="$json_array"
60+
else
61+
docs_matrix="[]"
62+
fi
63+
fi
64+
65+
echo "docs_matrix=$docs_matrix" >>$GITHUB_OUTPUT
66+
67+
docs-once:
68+
name: Gen README.md
69+
needs: docs-build
2170
permissions:
2271
contents: write
2372
runs-on: ubuntu-latest
2473
steps:
2574
- name: Checkout
2675
uses: actions/checkout@v4
27-
- name: Gen Vimdoc
76+
77+
- name: Create doc directory.
78+
run: rm -rvf doc; mkdir -pv doc
79+
80+
- name: README.md
2881
uses: kdheepak/panvimdoc@main
2982
with:
3083
vimdoc: neopywal
31-
description: "(Neo)pywal for (Neo)vim"
3284
pandoc: "README.md"
3385
toc: true
86+
treesitter: true
87+
demojify: true
3488
version: "nvim >= 0.8.0"
89+
description: "(Neo)pywal for (Neo)vim"
90+
91+
docs-multi:
92+
name: Gen docs/*.md
93+
needs:
94+
- docs-once
95+
- docs-build
96+
permissions:
97+
contents: write
98+
runs-on: ubuntu-latest
99+
strategy:
100+
matrix:
101+
docs: ${{ fromJson(needs.docs-build.outputs.docs_matrix) }}
102+
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
107+
- name: docs/*.md
108+
uses: kdheepak/panvimdoc@main
109+
with:
110+
toc: false
111+
demojify: true
35112
treesitter: true
36-
- name: Commit Docs
113+
shiftheadinglevelby: -1
114+
pandoc: ${{ matrix.docs.module }}
115+
vimdoc: ${{ matrix.docs.section }}
116+
description: ${{ matrix.docs.desc }}
117+
version: "nvim >= 0.8.0"
118+
119+
docs:
120+
name: Finalize vimdocs
121+
needs: docs-multi
122+
permissions:
123+
contents: write
124+
runs-on: ubuntu-latest
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@v4
128+
129+
- name: Install Neovim
130+
uses: rhysd/action-setup-vim@v1
131+
with:
132+
neovim: true
133+
version: "stable"
134+
135+
- name: Neovim Version
136+
run: nvim --version
137+
138+
- name: Gen helptags
139+
run: nvim --headless -c 'echo "Generating helptags ...\n"' -c 'helptags ./doc' -c 'echo "Helptags generated.\n"' -c 'quit'
140+
141+
- name: Commit docs
37142
if: ${{ !env.ACT }}
38143
uses: stefanzweifel/git-auto-commit-action@v4
39144
with:

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<b>Neopywal.nvim</b> is a Neovim colorscheme plugin that automatically fetches and applies the colors that are auto generated by <a href="https://github.com/dylanaraps/pywal">Pywal</a>, featuring plenty of configuration options and support for various plugins within the Neovim ecosystem.
99
</p>
1010

11+
> [!IMPORTANT]
12+
> Neopywal is under the process of a documentation update, so until v3.0.0 is released, expected slightly outdated documentation, or even slightly broken vim `:h neopywal` pages.
13+
1114
![01](./assets/screenshots/01.png)
1215
\
1316
![02](./assets/screenshots/02.png)
@@ -28,8 +31,8 @@
2831
- Automatic reloading of colorscheme with Pywal theme changes.
2932
- Support for LSP, treesitter and [a bunch of plugins](./docs/neopywal-plugins.md).
3033
- Enhanced syntax highlighting for [fileformats](./docs/neopywal-fileformats.md) (without treesitter).
31-
- [Compiled](#-Compilation) user's configuration for fast startup times.
32-
- [Interactive](#-Interactive-Mode) mode for live config re-loading.
34+
- [Compiled](#-compilation) user's configuration for fast startup times.
35+
- [Interactive](#-interactive-mode) mode for live config re-loading.
3336

3437
<!-- Installation {{{ -->
3538

@@ -111,7 +114,7 @@ When loading the "light" theme variant, Neopywal **won't** generate any new colo
111114
To use a genuine light theme with Neopywal, generate a new colorscheme with Pywal while using the `-l` flag.
112115

113116
```sh
114-
$ wal -l -i /path/to/your/image
117+
wal -l -i /path/to/your/image
115118
```
116119

117120
<!-- }}} -->
@@ -300,8 +303,8 @@ You can look for alternatives that will work with Neopywal in the following [sec
300303

301304
## 😍 Enjoy
302305

303-
Neopywal is a hobby project, however if you do like this work you can give this project a star ⭐
306+
Neopywal is a solo developed hobby project, however if you do like this work you can give this project a star ⭐
304307
\
305-
And if you really like the project and would like to help it grow, you can always send a PR modifying any part of the source code to your heart's content, any contribution is welcomed and greatly appreciated ;D
308+
And if you really like the project and would like to help it grow, you can always send a PR modifying any part of the source code to your heart's content, any contributions are welcomed and are greatly appreciated ;D
306309

307310
[//]: # "vim:fileencoding=utf-8:foldmethod=marker:foldenable"

doc/neopywal.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ To use a genuine light theme with Neopywal, generate a new colorscheme with
117117
Pywal while using the `-l` flag.
118118

119119
>sh
120-
$ wal -l -i /path/to/your/image
120+
wal -l -i /path/to/your/image
121121
<
122122

123123

@@ -302,10 +302,11 @@ with Neopywal in the following section
302302

303303
ENJOY *neopywal-enjoy*
304304

305-
Neopywal is a hobby project, however if you do like this work you can give this
306-
project a star Andif you really like the project and would like to help it
307-
grow, you can always send a PR modifying any part of the source code to your
308-
heart’s content, any contribution is welcomed and greatly appreciated ;D
305+
Neopywal is a solo developed hobby project, however if you do like this work
306+
you can give this project a star Andif you really like the project and would
307+
like to help it grow, you can always send a PR modifying any part of the source
308+
code to your heart’s content, any contributions are welcomed and are greatly
309+
appreciated ;D
309310

310311
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
311312

scripts/doc_build.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env sh
2+
3+
# Run this script on the cmd with `$ sh ./scripts/doc_build.sh`
4+
# while being on the root neopywal.nvim git path.
5+
# e.g, if the neopywal.nvim repo was cloned into ~/neopywal.nvim,
6+
# then cd EXACTLY into ~/neopywal.nvim and while inside that directory
7+
# run `$ sh ./scripts/doc_build.sh`.
8+
9+
if ! which pandoc >/dev/null 2>&1; then
10+
echo 'ERROR: pandoc not installed!'
11+
exit 1
12+
fi
13+
14+
PANVIMDOC_DIR="$(mktemp -d /tmp/tmp-panvimdoc.XXXXXXXX)"
15+
trap 'rm -rf "${PANVIMDOC_DIR}"' 0 1 15
16+
17+
echo 'Setting up panvimdoc ...'
18+
git clone "https://github.com/kdheepak/panvimdoc" "${PANVIMDOC_DIR}"
19+
20+
rm -rvf ./doc
21+
mkdir -pv ./doc
22+
panvimdoc() {
23+
echo '' # Only for easier to read terminal output.
24+
bash "${PANVIMDOC_DIR}"/panvimdoc.sh "${@}" || exit 1
25+
}
26+
27+
panvimdoc \
28+
--project-name 'neopywal' \
29+
--input-file ./README.md \
30+
--toc true \
31+
--demojify true \
32+
--treesitter true \
33+
--vim-version "nvim >= 0.8.0" \
34+
--description '(Neo)pywal for (Neo)vim'
35+
36+
find ./docs -type f ! -name "$(printf "*\n*")" -name '*.md' |
37+
while IFS= read -r file; do
38+
section=$(basename "${file}" .md)
39+
desc="$(basename "${file%.md}" | sed "s/-/ /g; s/[^ ]*/\u&/g")"
40+
41+
panvimdoc \
42+
--toc false \
43+
--demojify true \
44+
--treesitter true \
45+
--shift-heading-level-by -1 \
46+
--input-file "${file}" \
47+
--project-name "${section}" \
48+
--description "${desc}" \
49+
--vim-version "nvim >= 0.8.0" || exit 1
50+
51+
sed "s/\*${section}.txt\*/\*${section}\*/g" ./doc/"${section}.txt" >./doc/"tmp-${section}" || exit 1
52+
mv -vf ./doc/"tmp-${section}" ./doc/"${section}.txt" || exit 1
53+
done
54+
55+
nvim --headless \
56+
-c 'echo "Generating helptags ...\n"' \
57+
-c 'helptags ./doc' \
58+
-c 'echo "Helptags generated.\n"' \
59+
-c 'quit' || exit 1

0 commit comments

Comments
 (0)