From e8203321b9039c625a6619d5a36777cf0b4eda92 Mon Sep 17 00:00:00 2001 From: William Grant Date: Mon, 21 Aug 2023 16:19:57 +1000 Subject: [PATCH] feat: improved theming to documentation site with added search plugin --- docs/api/make-docs.sh | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/docs/api/make-docs.sh b/docs/api/make-docs.sh index 3174dc5e..5367c5f1 100755 --- a/docs/api/make-docs.sh +++ b/docs/api/make-docs.sh @@ -1,5 +1,11 @@ #!/bin/bash +# The following npm packages must be installed +# docsify-cli docsify-themeable docsify-katex@1.4.4 katex marked@4 + +# To customise the theme see: +# https://jhildenbiddle.github.io/docsify-themeable/#/customization + set -e if [ "$(basename $(pwd))" != "api" ]; then @@ -16,6 +22,7 @@ fi docsify init --local "$destdir" +rm -Rf "$destdir"/vendor/themes rm -f "$destdir"/README.md if [ -n "$NPM_PACKAGES" ]; then @@ -31,7 +38,16 @@ else exit 1 fi -cp $npm_dir/docsify/node_modules/prismjs/components/prism-{json,python}.min.js "$destdir"/vendor +cp $npm_dir/docsify/lib/plugins/search.min.js "$destdir"/vendor +cp $npm_dir/prismjs/components/prism-{json,python,http}.min.js "$destdir"/vendor +cp $npm_dir/docsify-themeable/dist/css/theme-simple.css "$destdir"/vendor +cp $npm_dir/docsify-themeable/dist/css/theme-simple-dark.css "$destdir"/vendor +cp $npm_dir/docsify-themeable/dist/js/docsify-themeable.min.js "$destdir"/vendor +cp $npm_dir/marked/marked.min.js "$destdir"/vendor +cp $npm_dir/katex/dist/katex.min.js "$destdir"/vendor +cp $npm_dir/katex/dist/katex.min.css "$destdir"/vendor +cp -R $npm_dir/katex/dist/fonts "$destdir"/vendor +cp $npm_dir/docsify-katex/dist/docsify-katex.js "$destdir"/vendor ./api-to-markdown.py --out="$destdir" "$@" @@ -48,16 +64,35 @@ if (m{^\s*\s*$}) { loadSidebar: "sidebar.md", subMaxLevel: 2, homepage: "index.md", + themeable: { + readyTransition : true, // default + responsiveTables: true // default + } } \n}; } } else { s{.*}{Libsession Utils API}; s{(name="description" content=)"[^"]*"}{$1"libsession-util function documentation"}; + s{^\s*\s*$}{}; if (m{^\s*}) { print qq{ + + + + + - \n}; + + + + + + \n}; } print; }' "$destdir"/index.html