diff --git a/.github/workflows/Docs.yaml b/.github/workflows/Docs.yaml index 0c0daed35..23fc2ab09 100644 --- a/.github/workflows/Docs.yaml +++ b/.github/workflows/Docs.yaml @@ -39,14 +39,18 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' + + - name: Format README.md + run: | + chmod +x format_readme.sh + ./format_readme.sh - name: Generate Docs run: | pip install mkdocs mkdocs-material Pygments ./gradlew dokkaGfmMultiModule --no-configuration-cache mv build/dokka/gfmMultiModule docs - cat README.md > docs/index.md mkdocs gh-deploy # https://github.com/softprops/action-gh-release/issues/236 diff --git a/format_readme.sh b/format_readme.sh new file mode 100644 index 000000000..d4328c26b --- /dev/null +++ b/format_readme.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# This script processes a README.md file and converts it to a docs/index.md file. +# It converts GitHub README admonitions to mkdocs admonitions. +# It also updates image paths from 'docs/assets/' to 'assets/'. + +while read -r line; do + if [[ $line =~ ^\>.* ]]; then # Detect if line starts with '>' + if [[ $line =~ \[\!TIP\] ]]; then + echo "!!! tip" + elif [[ $line =~ \[\!NOTE\] ]]; then + echo "!!! note" + elif [[ $line =~ \[\!WARNING\] ]]; then + echo "!!! warning" + elif [[ $line =~ \[\!IMPORTANT\] ]]; then + echo "!!! danger" + else + echo " ${line:1}" + fi + else + # Pass through any line not part of a block + echo "${line}" | sed -e 's/docs\/assets\/\([a-zA-Z0-9_\-]\+\.\(png\|jpg\|gif\)\)/assets\/\1/g' + fi + +done < README.md > docs/index.md