mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
b1786e88ac
Linking to line numbers is brittle, linking to sections/headings is better. If you still want to link to a line number, you can append ?plain=1 to GitHub's URL
42 lines
946 B
Bash
Executable File
42 lines
946 B
Bash
Executable File
#!/bin/sh -e
|
|
|
|
# Patch Python-Markdown
|
|
MARKDOWN_FILE=$(pip show markdown | awk '/Location/ { print $2 }')/markdown/extensions/codehilite.py
|
|
patch -N -r - $MARKDOWN_FILE lua_highlight.patch || true
|
|
|
|
# Split lua_api.md on top level headings
|
|
cat ../lua_api.md | csplit -sz -f docs/section - '/^=/-1' '{*}'
|
|
|
|
cat > mkdocs.yml << EOF
|
|
site_name: Minetest API Documentation
|
|
theme:
|
|
name: readthedocs
|
|
highlightjs: False
|
|
extra_css:
|
|
- css/code_styles.css
|
|
- css/extra.css
|
|
markdown_extensions:
|
|
- toc:
|
|
permalink: True
|
|
- codehilite
|
|
plugins:
|
|
- search:
|
|
separator: '[\s\-\.\(]+'
|
|
nav:
|
|
- "Home": index.md
|
|
EOF
|
|
|
|
mv docs/section00 docs/index.md
|
|
|
|
for f in docs/section*
|
|
do
|
|
title=$(head -1 $f)
|
|
fname=$(echo $title | tr '[:upper:]' '[:lower:]')
|
|
fname=$(echo $fname | sed 's/ /-/g')
|
|
fname=$(echo $fname | sed "s/'//g").md
|
|
mv $f docs/$fname
|
|
echo "- \"$title\": $fname" >> mkdocs.yml
|
|
done
|
|
|
|
mkdocs build --site-dir ../../public
|