From 85ccfe23139f7aa5efe28169e3bd1c363ea84c61 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 27 May 2026 13:24:06 +0200 Subject: [PATCH] pages branch Signed-off-by: Vladimir Mandic --- .github/workflows/build-pages.yml | 51 +++ .gitignore | 5 + .instructions.md | 35 +++ Gemfile | 12 + Gemfile.lock | 239 ++++++++++++++ _NOTES.md | 31 ++ _config.yml | 41 +++ _data/readme_sections.json | 38 +++ _includes/readme/community-and-support.html | 6 + _includes/readme/community-and-support.md | 10 + _includes/readme/evolution.html | 11 + _includes/readme/evolution.md | 12 + .../readme/features-and-capabilities.html | 20 ++ _includes/readme/features-and-capabilities.md | 20 ++ _includes/readme/getting-started.html | 18 ++ _includes/readme/getting-started.md | 23 ++ _includes/readme/hero.html | 15 + _includes/readme/hero.md | 20 ++ _includes/readme/license-credits.html | 5 + _includes/readme/license-credits.md | 4 + _includes/readme/supported-ai-models.html | 2 + _includes/readme/supported-ai-models.md | 3 + .../supported-platforms-and-hardware.html | 12 + .../supported-platforms-and-hardware.md | 12 + _includes/readme/table-of-contents.html | 17 + _includes/readme/table-of-contents.md | 21 ++ _layouts/default.html | 18 ++ assets/main.scss | 292 ++++++++++++++++++ docs.md | 35 +++ index.md | 27 ++ scripts/build-pages.py | 95 ++++++ 31 files changed, 1150 insertions(+) create mode 100644 .github/workflows/build-pages.yml create mode 100644 .gitignore create mode 100644 .instructions.md create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 _NOTES.md create mode 100644 _config.yml create mode 100644 _data/readme_sections.json create mode 100644 _includes/readme/community-and-support.html create mode 100644 _includes/readme/community-and-support.md create mode 100644 _includes/readme/evolution.html create mode 100644 _includes/readme/evolution.md create mode 100644 _includes/readme/features-and-capabilities.html create mode 100644 _includes/readme/features-and-capabilities.md create mode 100644 _includes/readme/getting-started.html create mode 100644 _includes/readme/getting-started.md create mode 100644 _includes/readme/hero.html create mode 100644 _includes/readme/hero.md create mode 100644 _includes/readme/license-credits.html create mode 100644 _includes/readme/license-credits.md create mode 100644 _includes/readme/supported-ai-models.html create mode 100644 _includes/readme/supported-ai-models.md create mode 100644 _includes/readme/supported-platforms-and-hardware.html create mode 100644 _includes/readme/supported-platforms-and-hardware.md create mode 100644 _includes/readme/table-of-contents.html create mode 100644 _includes/readme/table-of-contents.md create mode 100644 _layouts/default.html create mode 100644 assets/main.scss create mode 100644 docs.md create mode 100644 index.md create mode 100644 scripts/build-pages.py diff --git a/.github/workflows/build-pages.yml b/.github/workflows/build-pages.yml new file mode 100644 index 000000000..63f190709 --- /dev/null +++ b/.github/workflows/build-pages.yml @@ -0,0 +1,51 @@ +name: Build & Deploy GitHub Pages + +on: + push: + branches: + - pages + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: pages-checkout + uses: actions/checkout@v4 + + - name: pages-build + run: python3 scripts/build-pages.py + + - name: pages-ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: pages-dependencies + run: bundle install + + - name: pages-site + run: bundle exec jekyll build --destination ./_site + + - name: pages-upload + uses: actions/upload-pages-artifact@v3 + with: + path: ./_site + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: pages-deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..f40fbd8ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor diff --git a/.instructions.md b/.instructions.md new file mode 100644 index 000000000..a6b5c7d56 --- /dev/null +++ b/.instructions.md @@ -0,0 +1,35 @@ +# Workspace Assistant Instructions + +This file provides guidance for the default workspace assistant when working in the `sdnext-pages` repository. + +## Project Purpose + +- This repository creates the homepage for the [SD.Next](https://github.com/vladmandic/sdnext) project. +- The site is hosted on GitHub Pages and built using a custom GitHub Action + +## Assistant guidance + +- Prefer non-destructive suggestions and ask before making broad structural edits. +- Operate as the default workspace assistant for general requests unless the user explicitly requests a different mode. +- If a request is ambiguous or references files not described here, ask for clarification before proceeding. +- If additional repository context is needed, request it explicitly rather than guessing. + +## Project structure + +- `_config.yml` is the Jekyll configuration file. It sets site metadata, markdown parser settings, plugins, baseurl/url, and build options. +- `Gemfile` defines the Ruby gems used by Bundler for Jekyll. It should include Jekyll and the plugins configured in `_config.yml`. +- `_layouts/default.html` is the page shell template. Jekyll renders page content into the `{{ content }}` placeholder. +- `index.md` is the homepage source. Its front matter selects the layout and metadata, and its body assembles content using `{% include %}` partials. +- `_includes/` contains reusable HTML fragments. `index.md` uses `_includes/readme/*.html` to build the homepage. +- `_includes/readme/*.html` are generated by `scripts/build-pages.py` and should not be edited manually. +- `_site/` is the generated build output and should not be edited directly. +- `.github/workflows/build-pages.yml` defines the GitHub Actions workflow for building and deploying the site. + +## Common Commands + +- `bundle install` - Install Jekyll dependencies. +- `bundle exec jekyll build` - Build the site locally. +- `bundle exec jekyll serve` - Serve the site locally for testing. + +When adding or removing a plugin, update both `Gemfile` and `_config.yml` together, and run `bundle install` afterward. +When modifying any md/html/css content, run `bundle exec jekyll build` to regenerate the site and verify changes. diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..d441f8575 --- /dev/null +++ b/Gemfile @@ -0,0 +1,12 @@ +source "https://rubygems.org" + +gem "jekyll", "~> 4.4.1" + +gem "kramdown-parser-gfm" + +group :jekyll_plugins do + gem "jekyll-seo-tag" +end + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", platforms: [:jruby] diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..f8912713b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,239 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.9.0) + public_suffix (>= 2.0.2, < 8.0) + base64 (0.3.0) + bigdecimal (4.1.2) + colorator (1.1.0) + concurrent-ruby (1.3.6) + csv (3.3.5) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + eventmachine (1.2.7) + ffi (1.17.4) + ffi (1.17.4-aarch64-linux-gnu) + ffi (1.17.4-aarch64-linux-musl) + ffi (1.17.4-arm-linux-gnu) + ffi (1.17.4-arm-linux-musl) + ffi (1.17.4-arm64-darwin) + ffi (1.17.4-x86-linux-gnu) + ffi (1.17.4-x86-linux-musl) + ffi (1.17.4-x86_64-darwin) + ffi (1.17.4-x86_64-linux-gnu) + ffi (1.17.4-x86_64-linux-musl) + forwardable-extended (2.6.0) + google-protobuf (4.35.0) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-aarch64-linux-gnu) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-aarch64-linux-musl) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-arm64-darwin) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-x86-linux-gnu) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-x86-linux-musl) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-x86_64-darwin) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-x86_64-linux-gnu) + bigdecimal + rake (~> 13.3) + google-protobuf (4.35.0-x86_64-linux-musl) + bigdecimal + rake (~> 13.3) + http_parser.rb (0.8.1) + i18n (1.14.8) + concurrent-ruby (~> 1.0) + jekyll (4.4.1) + addressable (~> 2.4) + base64 (~> 0.2) + colorator (~> 1.0) + csv (~> 3.0) + em-websocket (~> 0.5) + i18n (~> 1.0) + jekyll-sass-converter (>= 2.0, < 4.0) + jekyll-watch (~> 2.0) + json (~> 2.6) + kramdown (~> 2.3, >= 2.3.1) + kramdown-parser-gfm (~> 1.0) + liquid (~> 4.0) + mercenary (~> 0.3, >= 0.3.6) + pathutil (~> 0.9) + rouge (>= 3.0, < 5.0) + safe_yaml (~> 1.0) + terminal-table (>= 1.8, < 4.0) + webrick (~> 1.7) + jekyll-sass-converter (3.1.0) + sass-embedded (~> 1.75) + jekyll-seo-tag (2.9.0) + jekyll (>= 3.8, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + json (2.19.5) + kramdown (2.5.2) + rexml (>= 3.4.4) + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.10.0) + logger + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + mercenary (0.3.6) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (7.0.5) + rake (13.4.2) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rexml (3.4.4) + rouge (3.30.0) + safe_yaml (1.0.5) + sass-embedded (1.100.0) + google-protobuf (~> 4.31) + rake (>= 13) + sass-embedded (1.100.0-aarch64-linux-android) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-aarch64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-aarch64-linux-musl) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-arm-linux-androideabi) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-arm-linux-gnueabihf) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-arm-linux-musleabihf) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-arm64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-riscv64-linux-android) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-riscv64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-riscv64-linux-musl) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-x86_64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-x86_64-linux-android) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-x86_64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.100.0-x86_64-linux-musl) + google-protobuf (~> 4.31) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + unicode-display_width (2.6.0) + webrick (1.9.2) + +PLATFORMS + aarch64-linux-android + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-androideabi + arm-linux-gnu + arm-linux-gnueabihf + arm-linux-musl + arm-linux-musleabihf + arm64-darwin + riscv64-linux-android + riscv64-linux-gnu + riscv64-linux-musl + ruby + x86-linux-gnu + x86-linux-musl + x86_64-darwin + x86_64-linux-android + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + http_parser.rb (~> 0.6.0) + jekyll (~> 4.4.1) + jekyll-seo-tag + kramdown-parser-gfm + +CHECKSUMS + addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd + bundler (4.0.12) sha256=7f8b757d28dfb636e7b24fba2344ac6dd13b5b24f4b46d62573d483f211825ac + colorator (1.1.0) sha256=e2f85daf57af47d740db2a32191d1bdfb0f6503a0dfbc8327d0c9154d5ddfc38 + concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab + csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f + em-websocket (0.5.3) sha256=f56a92bde4e6cb879256d58ee31f124181f68f8887bd14d53d5d9a292758c6a8 + eventmachine (1.2.7) sha256=994016e42aa041477ba9cff45cbe50de2047f25dd418eba003e84f0d16560972 + ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf + ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df + ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39 + ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564 + ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95 + ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b + ffi (1.17.4-x86-linux-gnu) sha256=38e150df5f4ca555e25beca4090823ae09657bceded154e3c52f8631c1ed72cf + ffi (1.17.4-x86-linux-musl) sha256=fbeec0fc7c795bcf86f623bb18d31ea1820f7bd580e1703a3d3740d527437809 + ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496 + ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d + ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e + forwardable-extended (2.6.0) sha256=1bec948c469bbddfadeb3bd90eb8c85f6e627a412a3e852acfd7eaedbac3ec97 + google-protobuf (4.35.0) sha256=95346162c792ed78c9a28cbf2d937a53f706de6df36a27471582f63f03c30c0d + google-protobuf (4.35.0-aarch64-linux-gnu) sha256=2cabd61b420918aec1564f9f7414e455bf922d20c5f8139d62783df5558a7aea + google-protobuf (4.35.0-aarch64-linux-musl) sha256=f6b11f3420a4564f68e8233c95eac6924f6a727dfc2f81a56af2e09add551501 + google-protobuf (4.35.0-arm64-darwin) sha256=66ab26d3fc82b8950702e53ab16c198e3c0ea3f2a38aaaf1f32152da45593ac5 + google-protobuf (4.35.0-x86-linux-gnu) sha256=7a5b5681c7d7bf28e1a6e285e45bf55c4ef47b7b1ca8af6ff79964255efece9a + google-protobuf (4.35.0-x86-linux-musl) sha256=f481b63b176c0335db8b50e46f033c0956857a599d9feafdd891a5c18ce28d43 + google-protobuf (4.35.0-x86_64-darwin) sha256=05eb5c8bc9899135befff496fc0a3642e7ff3d0943f043841dcc456f5654fea0 + google-protobuf (4.35.0-x86_64-linux-gnu) sha256=999226f3b00cd9fddb1b26851d16060212fa1d90c406aaad47e574682b716059 + google-protobuf (4.35.0-x86_64-linux-musl) sha256=be0218520d77b2aee898b363514b03819f6f63f9c041ae0d0d79b4ce5247bffd + http_parser.rb (0.8.1) sha256=9ae8df145b39aa5398b2f90090d651c67bd8e2ebfe4507c966579f641e11097a + i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5 + jekyll (4.4.1) sha256=4c1144d857a5b2b80d45b8cf5138289579a9f8136aadfa6dd684b31fe2bc18c1 + jekyll-sass-converter (3.1.0) sha256=83925d84f1d134410c11d0c6643b0093e82e3a3cf127e90757a85294a3862443 + jekyll-seo-tag (2.9.0) sha256=0260015a8e1df9bf195cdfb0c675b7b2883fd8cbf12556e1c1cbe36a831c6852 + jekyll-watch (2.2.1) sha256=bc44ed43f5e0a552836245a54dbff3ea7421ecc2856707e8a1ee203a8387a7e1 + json (2.19.5) sha256=218a18553e4801d579ca7e0f5bc72bafd776d7397238a1fb4e74db5b0a812c59 + kramdown (2.5.2) sha256=1ba542204c66b6f9111ff00dcc26075b95b220b07f2905d8261740c82f7f02fa + kramdown-parser-gfm (1.1.0) sha256=fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729 + liquid (4.0.4) sha256=4fcfebb1a045e47918388dbb7a0925e7c3893e58d2bd6c3b3c73ec17a2d8fdb3 + listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 + mercenary (0.3.6) sha256=2a084b18f5692c86a633e185d5311ba6d11fc46c802eb414ae05368178078a82 + pathutil (0.16.2) sha256=e43b74365631cab4f6d5e4228f812927efc9cb2c71e62976edcb252ee948d589 + public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623 + rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 + rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe + rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 + rouge (3.30.0) sha256=a3d353222aa72e49e2c86726c0bcfd719f82592f57d494474655f48e669eceb6 + safe_yaml (1.0.5) sha256=a6ac2d64b7eb027bdeeca1851fe7e7af0d668e133e8a88066a0c6f7087d9f848 + sass-embedded (1.100.0) sha256=b7d4831f304be5ba8717b2a1307644164b63dc158113a67f469e90578d3fc092 + sass-embedded (1.100.0-aarch64-linux-android) sha256=9603e1c26bea0396e849e3c3bb75b6843a43bae7a32c580084fd6c64260d9ef8 + sass-embedded (1.100.0-aarch64-linux-gnu) sha256=c13187f8eaae7e7e64246b18eb896534a84465a17198829ef65730db4662860e + sass-embedded (1.100.0-aarch64-linux-musl) sha256=1b0945a66cd4e40f505db73b1e790e2561e07e6d9fd04ef6ebbf279835666b3f + sass-embedded (1.100.0-arm-linux-androideabi) sha256=9948122504b69e20dc82a3b8fc20b3a61ea58a4713a713f64630b4c9a36f11e1 + sass-embedded (1.100.0-arm-linux-gnueabihf) sha256=a2de272bb02977ea91acaf3fecb6d8e09e4989501efbfc5375da4b5e7bff001d + sass-embedded (1.100.0-arm-linux-musleabihf) sha256=ce19837c10bab5ae6785f10b435a57a64ca027a99875cd701dc6fd3af317cbe5 + sass-embedded (1.100.0-arm64-darwin) sha256=d294b32c3b7bed293ad39bd392713c07f1df5454e65fa0f8d80dadbdba8a0cf4 + sass-embedded (1.100.0-riscv64-linux-android) sha256=148669225f027eeedea0a27e474dc69448567c030c56792114894f55a68af38e + sass-embedded (1.100.0-riscv64-linux-gnu) sha256=880ff1fca280b45b4d223366606aa634177adf38e793ad521426be7ad70a1ef2 + sass-embedded (1.100.0-riscv64-linux-musl) sha256=a8568d17343dcf0278d48b2efb4b3490ebe3ba0279ec4d69753e8ce4fd0614fa + sass-embedded (1.100.0-x86_64-darwin) sha256=3db80c837a60712de3461d5aa1be43c7056a0584d7182a8ae7a8996d64ab46d3 + sass-embedded (1.100.0-x86_64-linux-android) sha256=1600dbddf82c83344a5bc2a5e163081efdf15661f782922603574328888cd2cc + sass-embedded (1.100.0-x86_64-linux-gnu) sha256=58dd0a8a4f0dd78881b90d8b0e4d0eed042d54865b19b71384d91091ade93e18 + sass-embedded (1.100.0-x86_64-linux-musl) sha256=03dbee81bf93e770c725caf0c895e04c7b049ebef56b8a7002fcf21e6bedf7c5 + terminal-table (3.0.2) sha256=f951b6af5f3e00203fb290a669e0a85c5dd5b051b3b023392ccfd67ba5abae91 + unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a + webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131 + +BUNDLED WITH + 4.0.12 diff --git a/_NOTES.md b/_NOTES.md new file mode 100644 index 000000000..fe0eac5a0 --- /dev/null +++ b/_NOTES.md @@ -0,0 +1,31 @@ +# github pages + +## notes + +github-pages uses `github-pages` gem which is not compatible with latest `jekyll` +so build is done using custom github actions + +## create empty branch for github pages + +```shell +git clone https://github.com/vladmandic/sdnext sdnext-pages +cd sdnext-pages +git switch --orphan pages +git commit --allow-empty -m "gh-pages create empty" +git push -u origin pages +git log --oneline +``` + +## create site + +```shell +sudo apt-get install ruby-full build-essential zlib1g-dev +jekyll new --skip-bundle . +bundle install +``` + +## run locally + +```shell +bundle exec jekyll serve +``` diff --git a/_config.yml b/_config.yml new file mode 100644 index 000000000..ecd2be297 --- /dev/null +++ b/_config.yml @@ -0,0 +1,41 @@ +# Site settings + +# These are used to personalize your new site. If you look in the HTML files, you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible in the templates via {{ site.myvariable }}. + +title: SD.Next +email: your-email@example.com +description: >- + SD.Next: All-in-one WebUI for AI generative image and video creation, captioning and processing +baseurl: "/sdnext" +url: "https://vladmandic.github.io" + +markdown: kramdown +kramdown: + input: GFM + hard_wrap: false + syntax_highlighter: rouge + +# GH immutable plugins +plugins: + - jekyll-seo-tag + +# GH immutable settings +lsi: false +safe: true +source: "." +incremental: false +highlighter: rouge + +# Excludes defaults +exclude: + - .sass-cache/ + - .jekyll-cache/ + - gemfiles/ + - Gemfile + - Gemfile.lock + - node_modules/ + - vendor/bundle/ + - vendor/cache/ + - vendor/gems/ + - vendor/ruby/ diff --git a/_data/readme_sections.json b/_data/readme_sections.json new file mode 100644 index 000000000..ab47fe967 --- /dev/null +++ b/_data/readme_sections.json @@ -0,0 +1,38 @@ +[ + { + "slug": "hero", + "title": "hero" + }, + { + "slug": "table-of-contents", + "title": "Table of contents" + }, + { + "slug": "features-and-capabilities", + "title": "Features and Capabilities" + }, + { + "slug": "supported-ai-models", + "title": "Supported AI Models" + }, + { + "slug": "supported-platforms-and-hardware", + "title": "Supported Platforms and Hardware" + }, + { + "slug": "getting-started", + "title": "Getting started" + }, + { + "slug": "community-and-support", + "title": "Community and Support" + }, + { + "slug": "license-credits", + "title": "License & Credits" + }, + { + "slug": "evolution", + "title": "Evolution" + } +] \ No newline at end of file diff --git a/_includes/readme/community-and-support.html b/_includes/readme/community-and-support.html new file mode 100644 index 000000000..2386bb4eb --- /dev/null +++ b/_includes/readme/community-and-support.html @@ -0,0 +1,6 @@ +

Community and Support

+

If you're unsure how to use a feature, best place to start is Docs and if its not there,
+check ChangeLog for when feature was first introduced as it will always have a short note on how to use it

+

And for any question, reach out on Discord or open an issue or discussion

+

Contributing

+

Please see Contributing for details on how to contribute to this project

\ No newline at end of file diff --git a/_includes/readme/community-and-support.md b/_includes/readme/community-and-support.md new file mode 100644 index 000000000..fa5f65892 --- /dev/null +++ b/_includes/readme/community-and-support.md @@ -0,0 +1,10 @@ +## Community and Support + +If you're unsure how to use a feature, best place to start is [Docs](https://vladmandic.github.io/sdnext-docs/) and if its not there, +check [ChangeLog](https://vladmandic.github.io/sdnext-docs/CHANGELOG/) for when feature was first introduced as it will always have a short note on how to use it + +And for any question, reach out on [Discord](https://discord.gg/VjvR2tabEX) or open an [issue](https://github.com/vladmandic/sdnext/issues) or [discussion](https://github.com/vladmandic/sdnext/discussions) + +### Contributing + +Please see [Contributing](https://raw.githubusercontent.com/vladmandic/sdnext/refs/heads/dev/CONTRIBUTING) for details on how to contribute to this project diff --git a/_includes/readme/evolution.html b/_includes/readme/evolution.html new file mode 100644 index 000000000..09a59ad00 --- /dev/null +++ b/_includes/readme/evolution.html @@ -0,0 +1,11 @@ +

Evolution

+ + + + starts + + + +
\ No newline at end of file diff --git a/_includes/readme/evolution.md b/_includes/readme/evolution.md new file mode 100644 index 000000000..27a47771c --- /dev/null +++ b/_includes/readme/evolution.md @@ -0,0 +1,12 @@ +## Evolution + + + + + starts + + + +- [OSS Stats](https://ossinsight.io/analyze/vladmandic/sdnext#overview) + +
diff --git a/_includes/readme/features-and-capabilities.html b/_includes/readme/features-and-capabilities.html new file mode 100644 index 000000000..31af63b20 --- /dev/null +++ b/_includes/readme/features-and-capabilities.html @@ -0,0 +1,20 @@ +

Features and Capabilities

+

SD.Next is feature-rich with a focus on performance, flexibility, and user experience. Key features include:

+ +

Unique features

+

SD.Next includes many features not found in other WebUIs, such as:

+ +
\ No newline at end of file diff --git a/_includes/readme/features-and-capabilities.md b/_includes/readme/features-and-capabilities.md new file mode 100644 index 000000000..8db5469f1 --- /dev/null +++ b/_includes/readme/features-and-capabilities.md @@ -0,0 +1,20 @@ +## Features and Capabilities + +SD.Next is feature-rich with a focus on performance, flexibility, and user experience. Key features include: +- [Multi-platform](https://vladmandic.github.io/sdnext-docs/nVidia/)! +- Many [diffusion models](https://vladmandic.github.io/sdnext-docs/Model-Support/)! +- Fully localized to ~15 languages and with support for many [UI themes](https://vladmandic.github.io/sdnext-docs/Themes/)! +- [Desktop](#screenshot-desktop-interface) and [Mobile](#screenshot-mobile-interface) support! +- Platform specific auto-detection and tuning performed on install +- Built in installer with automatic updates and dependency management + +### Unique features + +SD.Next includes many features not found in other WebUIs, such as: +- **SDNQ**: State-of-the-Art quantization engine + Use pre-quantized or run with quantization on-the-fly for up to 4x VRAM reduction with no or minimal quality and performance impact +- **Balanced Offload**: Dynamically balance CPU and GPU memory to run larger models on limited hardware +- **Captioning** with 150+ **OpenCLiP** models, **Tagger** with **WaifuDiffusion** and **DeepDanbooru** models, and 25+ built-in **VLMs** +- **Image Processing** with full image correction color-grading suite of tools + +
diff --git a/_includes/readme/getting-started.html b/_includes/readme/getting-started.html new file mode 100644 index 000000000..c190debe7 --- /dev/null +++ b/_includes/readme/getting-started.html @@ -0,0 +1,18 @@ +

Getting started

+ +

Tip

And for platform specific information, check out
+WSL | Intel Arc | DirectML | OpenVINO | ONNX & Olive | ZLUDA | AMD ROCm | MacOS | nVidia | Docker

+
+

Quick Start

+
git clone https://github.com/vladmandic/sdnext
+cd sdnext
+./webui.sh # Linux/Mac
+webui.bat  # Windows
+webui.ps1  # PowerShell
+

Warning

If you run into issues, check out troubleshooting and debugging guides

+
\ No newline at end of file diff --git a/_includes/readme/getting-started.md b/_includes/readme/getting-started.md new file mode 100644 index 000000000..9ae527edd --- /dev/null +++ b/_includes/readme/getting-started.md @@ -0,0 +1,23 @@ +## Getting started + +- Get started with **SD.Next** by following the [installation instructions](https://vladmandic.github.io/sdnext-docs/Installation/) +- For more details, check out [advanced installation](https://vladmandic.github.io/sdnext-docs/Advanced-Install/) guide +- List and explanation of [command line arguments](https://vladmandic.github.io/sdnext-docs/CLI-Arguments/) +- Install walkthrough [video](https://www.youtube.com/watch?v=nWTnTyFTuAs) + +> [!TIP] +> And for platform specific information, check out +> [WSL](https://vladmandic.github.io/sdnext-docs/WSL/) | [Intel Arc](https://vladmandic.github.io/sdnext-docs/Intel-ARC/) | [DirectML](https://vladmandic.github.io/sdnext-docs/DirectML/) | [OpenVINO](https://vladmandic.github.io/sdnext-docs/OpenVINO/) | [ONNX & Olive](https://vladmandic.github.io/sdnext-docs/ONNX-Runtime/) | [ZLUDA](https://vladmandic.github.io/sdnext-docs/ZLUDA/) | [AMD ROCm](https://vladmandic.github.io/sdnext-docs/AMD-ROCm/) | [MacOS](https://vladmandic.github.io/sdnext-docs/MacOS-Python/) | [nVidia](https://vladmandic.github.io/sdnext-docs/nVidia/) | [Docker](https://vladmandic.github.io/sdnext-docs/Docker/) + +### Quick Start + +```shell +git clone https://github.com/vladmandic/sdnext +cd sdnext +./webui.sh # Linux/Mac +webui.bat # Windows +webui.ps1 # PowerShell +``` + +> [!WARNING] +> If you run into issues, check out [troubleshooting](https://vladmandic.github.io/sdnext-docs/Troubleshooting/) and [debugging](https://vladmandic.github.io/sdnext-docs/Debug/) guides diff --git a/_includes/readme/hero.html b/_includes/readme/hero.html new file mode 100644 index 000000000..e4d29391f --- /dev/null +++ b/_includes/readme/hero.html @@ -0,0 +1,15 @@ +
+SD.Next: AI art generator logo +

SD.Next: All-in-one WebUI

+

SD.Next is a powerful, open-source WebUI app for AI image and video generation, built on Stable Diffusion and supporting dozens of advanced models. Create, caption, and process images and videos with a modern, cross-platform interface—perfect for artists, researchers, and AI enthusiasts.

+

Stars
+Forks
+Contributors
+Last update
+License
+Discord
+DeepWiki
+Sponsors

+

Docs | Wiki | Discord | Changelog

+
+
\ No newline at end of file diff --git a/_includes/readme/hero.md b/_includes/readme/hero.md new file mode 100644 index 000000000..94474bb97 --- /dev/null +++ b/_includes/readme/hero.md @@ -0,0 +1,20 @@ +
+SD.Next: AI art generator logo + +# SD.Next: All-in-one WebUI + +SD.Next is a powerful, open-source WebUI app for AI image and video generation, built on Stable Diffusion and supporting dozens of advanced models. Create, caption, and process images and videos with a modern, cross-platform interface—perfect for artists, researchers, and AI enthusiasts. + +![Stars](https://img.shields.io/github/stars/vladmandic/sdnext?style=social) +![Forks](https://img.shields.io/github/forks/vladmandic/sdnext?style=social) +![Contributors](https://img.shields.io/github/contributors/vladmandic/sdnext) +![Last update](https://img.shields.io/github/last-commit/vladmandic/sdnext?svg=true) +![License](https://img.shields.io/github/license/vladmandic/sdnext?svg=true) +[![Discord](https://img.shields.io/discord/1101998836328697867?logo=Discord&svg=true)](https://discord.gg/VjvR2tabEX) +[![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/vladmandic/sdnext) +[![Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/vladmandic) + +[Docs](https://vladmandic.github.io/sdnext-docs/) | [Wiki](https://github.com/vladmandic/sdnext/wiki) | [Discord](https://discord.gg/VjvR2tabEX) | [Changelog](CHANGELOG.md) + +
+
diff --git a/_includes/readme/license-credits.html b/_includes/readme/license-credits.html new file mode 100644 index 000000000..9eef4a59e --- /dev/null +++ b/_includes/readme/license-credits.html @@ -0,0 +1,5 @@ +

License & Credits

+ \ No newline at end of file diff --git a/_includes/readme/license-credits.md b/_includes/readme/license-credits.md new file mode 100644 index 000000000..c09085fa5 --- /dev/null +++ b/_includes/readme/license-credits.md @@ -0,0 +1,4 @@ +## License & Credits + +- SD.Next is licensed under the [Apache License 2.0](LICENSE.txt) +- Main credit goes to [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) for the original codebase diff --git a/_includes/readme/supported-ai-models.html b/_includes/readme/supported-ai-models.html new file mode 100644 index 000000000..5a3cbfcb8 --- /dev/null +++ b/_includes/readme/supported-ai-models.html @@ -0,0 +1,2 @@ +

Supported AI Models

+

SD.Next supports broad range of models: supported models and model specs

\ No newline at end of file diff --git a/_includes/readme/supported-ai-models.md b/_includes/readme/supported-ai-models.md new file mode 100644 index 000000000..4a78e755f --- /dev/null +++ b/_includes/readme/supported-ai-models.md @@ -0,0 +1,3 @@ +## Supported AI Models + +SD.Next supports broad range of models: [supported models](https://vladmandic.github.io/sdnext-docs/Model-Support/) and [model specs](https://vladmandic.github.io/sdnext-docs/Models/) diff --git a/_includes/readme/supported-platforms-and-hardware.html b/_includes/readme/supported-platforms-and-hardware.html new file mode 100644 index 000000000..cacec761d --- /dev/null +++ b/_includes/readme/supported-platforms-and-hardware.html @@ -0,0 +1,12 @@ +

Supported Platforms and Hardware

+ +

Plus Docker container recipes for: CUDA, ROCm, Intel IPEX and OpenVINO

\ No newline at end of file diff --git a/_includes/readme/supported-platforms-and-hardware.md b/_includes/readme/supported-platforms-and-hardware.md new file mode 100644 index 000000000..43f1fe1ff --- /dev/null +++ b/_includes/readme/supported-platforms-and-hardware.md @@ -0,0 +1,12 @@ +## Supported Platforms and Hardware + +- *nVidia* GPUs using **CUDA** libraries on both *Windows and Linux* +- *AMD* GPUs using **ROCm** libraries on both *Linux and Windows* +- *AMD* GPUs on Windows using **ZLUDA** libraries +- *Intel Arc* GPUs using **OneAPI** with *IPEX XPU* libraries on both *Windows and Linux* +- Any *CPU/GPU* or device compatible with **OpenVINO** libraries on both *Windows and Linux* +- Any GPU compatible with *DirectX* on *Windows* using **DirectML** libraries +- *Apple M1/M2* on *OSX* using built-in support in Torch with **MPS** optimizations +- *ONNX/Olive* + +Plus **Docker** container recipes for: [CUDA, ROCm, Intel IPEX and OpenVINO](https://vladmandic.github.io/sdnext-docs/Docker/) diff --git a/_includes/readme/table-of-contents.html b/_includes/readme/table-of-contents.html new file mode 100644 index 000000000..0d772e56a --- /dev/null +++ b/_includes/readme/table-of-contents.html @@ -0,0 +1,17 @@ +

Table of contents

+ +

Screenshot: Desktop interface

+
+SD.Next: AI art generator desktop interface screenshot +
+

Screenshot: Mobile interface

+
+SD.Next: AI art generator mobile interface screenshot +
+
\ No newline at end of file diff --git a/_includes/readme/table-of-contents.md b/_includes/readme/table-of-contents.md new file mode 100644 index 000000000..af26e3a4b --- /dev/null +++ b/_includes/readme/table-of-contents.md @@ -0,0 +1,21 @@ +## Table of contents + +- [Documentation](https://vladmandic.github.io/sdnext-docs/) +- [Features & Capabilities](#features-and-capabilities) +- [Supported AI Models](#supported-ai-models) +- [Supported Platforms & Hardware](#supported-platforms-and-hardware) +- [Getting started](#getting-started) + +### Screenshot: Desktop interface + +
+SD.Next: AI art generator desktop interface screenshot +
+ +### Screenshot: Mobile interface + +
+SD.Next: AI art generator mobile interface screenshot +
+ +
diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 000000000..a33fe3faa --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,18 @@ + + + + + + {{ page.title | default: site.title }} + + {% seo %} + + + +
+
+
{{ content }}
+
+
+ + diff --git a/assets/main.scss b/assets/main.scss new file mode 100644 index 000000000..123d642b9 --- /dev/null +++ b/assets/main.scss @@ -0,0 +1,292 @@ +--- +--- + +:root { + color-scheme: dark; + --bg: hsl(214, 24%, 7%); + --surface: hsl(214, 20%, 13%); + --surface-strong: hsl(214, 18%, 17%); + --surface-soft: rgba(255, 255, 255, 0.04); + --surface-glow: rgba(86, 169, 230, 0.15); + --text: hsl(0, 0%, 95%); + --muted: hsl(220, 6%, 68%); + --accent: hsl(183, 82%, 62%); + --accent-strong: hsl(183, 94%, 72%); + --border: rgba(255, 255, 255, 0.08); + --shadow-dark: rgba(0, 0, 0, 0.45); + --shadow-light: rgba(255, 255, 255, 0.08); +} + +* { + box-sizing: border-box; +} + +body { + margin: 0; + min-height: 100vh; + font-family: 'Inter', 'Noto Sans', system-ui, sans-serif; + background: radial-gradient(circle at top left, rgba(86, 169, 230, 0.14), transparent 25%), + radial-gradient(circle at bottom right, rgba(120, 255, 240, 0.08), transparent 30%), + var(--bg); + color: var(--text); +} + +body::before { + content: ''; + position: fixed; + inset: 0; + pointer-events: none; + background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08), transparent 14%), + radial-gradient(circle at 85% 15%, rgba(86,169,230,0.08), transparent 9%), + radial-gradient(circle at 50% 90%, rgba(120,255,240,0.04), transparent 18%); + opacity: 0.9; +} + +a { + color: var(--accent); + text-decoration: none; + transition: color 180ms ease, transform 180ms ease; +} + +a:hover, +a:focus-visible { + color: var(--accent-strong); + transform: translateY(-1px); +} + +.wrapper { + width: min(1120px, calc(100% - 3rem)); + margin: 0 auto; +} + +.page-content { + padding: 2.5rem 0 3rem; +} + +.content-wrapper { + padding: 1rem 1.5rem 0; +} + +.page-shell { + position: relative; + z-index: 1; +} + +.hero-card, +.toc-card, +.readme-section { + background: var(--surface-strong); + border-radius: 2rem; + box-shadow: inset 1px 1px 1px rgba(255, 255, 255, 0.4),inset -1px -1px 1px rgba(100, 255, 255, 0.2),18px 18px 46px rgba(100, 255, 255, 0.05); + backdrop-filter: blur(12px); +} + +.hero-card { + padding: 2rem; +} + +.hero-shell { + display: grid; +} + +.homepage-shell { + display: grid; + gap: 1.5rem; +} + +.content-shell { + display: grid; + gap: 1.5rem; +} + +h1, +h2, +h3 { + color: var(--text); +} + +h1 { + font-size: clamp(2.75rem, 4vw, 4rem); + text-align: center; + letter-spacing: -0.04em; + margin-bottom: 0.5rem; + text-shadow: 0 0px 0px rgba(255, 255, 255, 0), 0 16px 16px rgba(100, 255, 255, 0.2); +} + +h2 { + font-size: clamp(1.9rem, 2.4vw, 2.4rem); + margin-bottom: 1rem; + position: relative; + color: var(--text); + text-shadow: 0 0px 0px rgba(255, 255, 255, 0), 0 8px 8px rgba(100, 255, 255, 0.2); +} + +h2::before { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; +} + +h2::after { + content: ""; + position: absolute; + left: 0; + bottom: -0.2em; + width: 40%; + height: 0.15em; + border-radius: 1em; + background: linear-gradient(90deg, var(--accent), transparent); +} + +h3 { + margin: 1.5rem 0 0.5rem; +} + +p, +ul, +blockquote, +pre, +code { + margin: 0; + color: var(--muted); + line-height: 1.75em; +} + +p + p, +ul + p, +pre + p, +blockquote + p, +code + p { + margin-top: 1rem; +} + +ul { + margin: 0 0 1.25rem 1.5rem; + padding: 0; +} + +li + li { + margin-top: 0.65rem; +} + +pre, +code { + background: rgba(255, 255, 255, 0.03); + color: var(--text); + border: 1px solid rgba(255, 255, 255, 0.08); +} + +pre { + margin: 0 0 1.25rem; + padding: 1.1rem 1rem; + overflow-x: auto; + border-radius: 1rem; +} + +code { + padding: 0.35rem 0.55rem; + border-radius: 0.75rem; +} + +blockquote { + margin: 0 0 1.25rem; + padding: 1.25rem 1.35rem; + border-left: 4px solid rgba(97, 236, 241, 0.28); + background: rgba(255, 255, 255, 0.03); +} + +.markdown-alert { + margin: 1.25rem 0; + padding: 1.25rem; + border-radius: 1.5rem; + border: 1px solid rgba(255, 255, 255, 0.08); + background: rgba(255, 255, 255, 0.025); +} + +.markdown-alert-title { + margin: 0 0 0.75rem; + font-weight: 700; + color: var(--text); +} + +.markdown-alert-tip { + background-color: rgba(30, 50, 70, 0.55); +} + +.markdown-alert-warning { + background-color: rgba(55, 5, 75, 0.55); +} + +.readme-section { + position: relative; + padding: 2rem; + overflow: hidden; + background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 65%), + radial-gradient(circle at top right, rgba(97, 236, 241, 0.12), transparent 18%), + radial-gradient(circle at 20% 10%, rgba(86, 169, 230, 0.1), transparent 16%); +} + +.readme-section::before { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; + background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 35%, rgba(0, 0, 0, 0.08)); +} + +.readme-section h2 { + font-weight: 700; +} + +.readme-section h3 { + margin: 1.5rem 0 0.5rem; +} + +.hero-card p { + justify-self: center; +} + +.hero-card p { + display: flex; + padding: 0em 1em 0.6em 1em +} + +.hero-card p:last-of-type a { + margin: 0 0.6em; +} + +.svg-glow, +svg { + align-self: center; + margin-right: 0.5em; + fill: var(--accent); +} + +.readme-section:hover, +.hero-card:hover, +.toc-card:hover { + transform: translateY(-1px); + box-shadow: + inset 1px 1px 1px rgba(255, 255, 255, 0.06), + inset -1px -1px 1px rgba(0, 0, 0, 0.2), + 22px 22px 54px rgba(0, 0, 0, 0.32); +} + +.readme-section, +.hero-card, +.toc-card { + transition: transform 180ms ease, box-shadow 180ms ease; +} + +@media (max-width: 768px) { + .wrapper { + width: min(100%, calc(100% - 2rem)); + } + + .hero-card, + .readme-section, + .toc-card { + padding: 1.5rem; + } +} diff --git a/docs.md b/docs.md new file mode 100644 index 000000000..05f1b9e3d --- /dev/null +++ b/docs.md @@ -0,0 +1,35 @@ +--- +layout: default +title: Documentation +permalink: /docs/ +description: "SD.Next documentation and guides for setup, hardware support, and advanced usage." +--- + + + +
+
+

Documentation

+

SD.Next Guides & Resources

+
+ +

Explore the documentation hub for installation instructions, platform-specific setup, model support, and advanced workflows.

+ +
+ +
+

Hardware support

+

Learn how SD.Next detects and optimizes nVidia, AMD, Intel, OpenVINO, and Apple platforms.

+ View platform guides +
+
+

Model support

+

Browse supported AI models, quantization workflows, and advanced inference options.

+ See supported models +
+
+
diff --git a/index.md b/index.md new file mode 100644 index 000000000..ecb21454d --- /dev/null +++ b/index.md @@ -0,0 +1,27 @@ +--- +layout: default +title: SD.Next +permalink: / +description: "SD.Next is a powerful, open-source WebUI app for AI image and video generation, built on Stable Diffusion and supporting dozens of advanced models." +--- + +
+
+ {% assign hero_section = site.data.readme_sections | where: "slug", "hero" | first %} + {% if hero_section %} +
+ {% include readme/{{ hero_section.slug }}.html %} +
+ {% endif %} +
+ +
+ {% for section in site.data.readme_sections %} + {% unless section.slug == "hero" %} +
+ {% include readme/{{ section.slug }}.html %} +
+ {% endunless %} + {% endfor %} +
+
diff --git a/scripts/build-pages.py b/scripts/build-pages.py new file mode 100644 index 000000000..854d68df9 --- /dev/null +++ b/scripts/build-pages.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +import json +import os +import re +from pathlib import Path +from urllib.request import Request, urlopen + +ROOT = Path(__file__).resolve().parent.parent +README_URL = "https://raw.githubusercontent.com/vladmandic/sdnext/refs/heads/dev/README.md" +GITHUB_MARKDOWN_API = "https://api.github.com/markdown" +OUT_DIR = ROOT / "_includes" / "readme" +DATA_FILE = ROOT / "_data" / "readme_sections.json" + +pattern = re.compile(r"^(##)\s+(.*)$") + + +def slugify(text: str) -> str: + slug = text.strip().lower() + slug = re.sub(r"[^a-z0-9]+", "-", slug) + return slug.strip("-") + + +def github_render(markdown_text: str) -> str: + headers = { + "User-Agent": "sdnext-pages-script/1.0", + "Content-Type": "application/json", + } + token = os.environ.get("GITHUB_TOKEN") + if token: + headers["Authorization"] = f"token {token}" + + payload = json.dumps({"text": markdown_text, "mode": "gfm"}).encode("utf-8") + request = Request(GITHUB_MARKDOWN_API, data=payload, headers=headers) + with urlopen(request, timeout=20) as response: + return response.read().decode("utf-8") + + +def main() -> int: + OUT_DIR.mkdir(parents=True, exist_ok=True) + DATA_FILE.parent.mkdir(parents=True, exist_ok=True) + + request = Request(README_URL, headers={"User-Agent": "sdnext-pages-script/1.0"}) + with urlopen(request, timeout=20) as response: + data = response.read().decode("utf-8") + + lines = data.splitlines() + sections = [] + current = {"slug": "hero", "title": "hero", "lines": []} + + for line in lines: + match = pattern.match(line) + if match: + if current["lines"]: + sections.append(current) + current = { + "slug": slugify(match.group(2)), + "title": match.group(2).strip(), + "lines": [line], + } + else: + current["lines"].append(line) + + if current["lines"]: + sections.append(current) + + for section in sections: + source = "\n".join(section["lines"]).rstrip() + "\n" + md_path = OUT_DIR / f"{section['slug']}.md" + html_path = OUT_DIR / f"{section['slug']}.html" + + md_path.write_text(source, encoding="utf-8") + + try: + rendered = github_render(source) + except Exception as exc: + print(f"Warning: GitHub markdown render failed for {section['slug']}: {exc}") + rendered = source + + html_path.write_text(rendered, encoding="utf-8") + + DATA_FILE.write_text( + json.dumps( + [{"slug": section["slug"], "title": section["title"]} for section in sections], + indent=2, + ), + encoding="utf-8", + ) + + print(f"Generated {len(sections)} README section includes in {OUT_DIR}") + print(f"Saved section metadata to {DATA_FILE}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())