-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from yougotwill/docs_website_improvements
feat: improved theming to documentation site with added search plugin
- Loading branch information
Showing
1 changed file
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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*<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 |