~zenomat/tinywiki

71b89b7b97084e59556279a6c43754a316bd2dda — zeno 3 months ago c0f36fe
Local katex sources
2 files changed, 13 insertions(+), 7 deletions(-)

M README.md
M build.sh
M README.md => README.md +3 -3
@@ 9,8 9,8 @@ Tinywiki is a simple bash script, which converts a folder into a static html wik

# Features
- Table of contents insertion with [[toc]]
- katex math (currently with external dependency on katex cdn, in the future, katex js and css locally)
- subfolders
- katex math (katex libs locally, so no external cdns)
- pandoc frontmatter
- subfolders
- maybe some others I am forgetting
- beautiful styling
- (beautiful) styling

M build.sh => build.sh +10 -4
@@ 6,7 6,13 @@ outdir="$workdir/public_html"

mkdir -p "$outdir/tmp"
mkdir -p "$outdir/assets"
cp "$HOME/.local/share/tinywiki/template.html" "$HOME/.local/share/tinywiki/style.css" "$outdir/assets"
mkdir -p "$outdir/assets/css"
mkdir -p "$outdir/assets/js"
cp "$HOME/.local/share/tinywiki/template.html" "$outdir/assets"
cp "$HOME/.local/share/tinywiki/style.css" "$outdir/assets/css"
cp "$HOME/.local/share/tinywiki/katex.min.css" "$outdir/assets/css"
cp "$HOME/.local/share/tinywiki/katex.min.js" "$outdir/assets/js"


cd "$workdir"



@@ 37,9 43,9 @@ find . -name "*.md" ! -name "toc.md" | while read -r file; do
	sed -ie "s/$escaped_match/$escaped_link/" "$outdir/tmp/$name.md"
done
mkdir -p $outdir/$path
pandoc -s --template="$outdir/assets/template.html" -V home="$path_to_root/index.html" --css=$path_to_root/assets/style.css --highlight-style breezedark -f markdown+hard_line_breaks --katex $outdir/tmp/"$name".md -o $outdir/$path/$name.html
sed -i "s/https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/KaTeX\/0.11.1\/katex.min.css/$escaped_path_to_root\/assets\/css\/katex.min.css/g" "$outdir/$path/$name.html"
sed -i "s/https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/KaTeX\/0.11.1\/katex.min.js/$escaped_path_to_root\/assets\/js\/katex.min.js/g" "$outdir/$path/$name.html"
pandoc -s --template="$outdir/assets/template.html" -V home="$path_to_root/index.html" --css=$path_to_root/assets/css/style.css --highlight-style breezedark -f markdown+hard_line_breaks --katex $outdir/tmp/"$name".md -o $outdir/$path/$name.html
sed -i "s/https:\/\/cdn.jsdelivr.net\/npm\/katex@[0-9]*\.[0-9]*\.[0-9]*\/dist\/katex.min.css/$escaped_path_to_root\/assets\/css\/katex.min.css/g" "$outdir/$path/$name.html"
sed -i "s/https:\/\/cdn.jsdelivr.net\/npm\/katex@[0-9]*\.[0-9]*\.[0-9]*\/dist\/katex.min.js/$escaped_path_to_root\/assets\/js\/katex.min.js/g" "$outdir/$path/$name.html"
done
cd $workdir
rm -rf $outdir/tmp