Skip to content

Commit

Permalink
Merge pull request #47 from yougotwill/docs_website_improvements
Browse files Browse the repository at this point in the history
feat: improved theming to documentation site with added search plugin
  • Loading branch information
jagerman authored Aug 21, 2023
2 parents 5f8f751 + e820332 commit 7fe3a48
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions docs/api/make-docs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

# The following npm packages must be installed
# docsify-cli docsify-themeable [email protected] katex marked@4

# To customise the theme see:
# https://jhildenbiddle.github.io/docsify-themeable/#/customization

set -e

if [ "$(basename $(pwd))" != "api" ]; then
Expand All @@ -16,6 +22,7 @@ fi

docsify init --local "$destdir"

rm -Rf "$destdir"/vendor/themes
rm -f "$destdir"/README.md

if [ -n "$NPM_PACKAGES" ]; then
Expand All @@ -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" "$@"

Expand All @@ -48,16 +64,35 @@ if (m{^\s*<script>\s*$} .. m{^\s*</script>\s*$}) {
loadSidebar: "sidebar.md",
subMaxLevel: 2,
homepage: "index.md",
themeable: {
readyTransition : true, // default
responsiveTables: true // default
}
}
</script>\n};
}
} else {
s{<title>.*</title>}{<title>Libsession Utils API</title>};
s{(name="description" content=)"[^"]*"}{$1"libsession-util function documentation"};
s{^\s*<link rel="stylesheet" href="vendor/themes/vue.css">\s*$}{};
if (m{^\s*</body>}) {
print qq{
<link rel="stylesheet" href="vendor/katex.min.css" />
<link rel="stylesheet" media="(prefers-color-scheme: light)" href="vendor/theme-simple.css">
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="vendor/theme-simple-dark.css">
<style>
:root {
--content-max-width : 1100px;
}
</style>
<script src="vendor/search.min.js"></script>
<script src="vendor/prism-json.min.js"></script>
<script src="vendor/prism-python.min.js"></script>\n};
<script src="vendor/prism-python.min.js"></script>
<script src="vendor/prism-http.min.js"></script>
<script src="vendor/marked.min.js"></script>
<script src="vendor/katex.min.js"></script>
<script src="vendor/docsify-katex.js"></script>
<script src="vendor/docsify-themeable.min.js"></script>\n};
}
print;
}' "$destdir"/index.html

0 comments on commit 7fe3a48

Please sign in to comment.