This site is mainly created for storing main topic about algorithm, data structure and related problems..
Thanks to mkdocs and mkdocs-material open source python developers.
This site is created only by python packages.
There are a lot of ways to build and deploy mkdocs static site.
This is one of the simplest ways to build and deploy in github.
first install python and then install pip in terminal.
then install mkdocs.
$ pip3 install mkdocs
Then make a site and enter those folder.
$ mkdocs new site
$ cd site
Then to see local website view.
$ mkdocs serve
then install mkdocs-material theme
$ pip3 install mkdocs-material
then add some mkdocs plugin.
$ pip3 install mkdocs-simple-hooks
To make Readme.md to index.md, push a python file in source directory.
hook.py
import shutil
def copy_readme(*args, **kwargs):
shutil.copy("README.md", "src/index.md")
plugins:
- search
- mkdocs-simple-hooks:
hooks:
on_pre_build: "hooks:copy_readme"
Then edit some minor things in mcdocs.yml.
theme:
name: material
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/brightness-4
name: Switch to system preference
icon:
repo: fontawesome/brands/github
edit: material/pencil-box-outline
view: material/eye
features:
- navigation.tracking
- navigation.tabs
- toc.integrate
- search.suggest
- content.action.edit
- content.action.view
markdown_extensions:
- pymdownx.arithmatex:
generic: true
tex_inline_wrap: ['$', '$']
tex_block_wrap: ['$$', '$$']
- pymdownx.highlight
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- attr_list
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
- meta
Installed extra pakages except mkdocs-simple-hooks for later updates in this site.
#!/bin/bash
pip3 install \
mkdocs-material \
mkdocs-macros-plugin \
mkdocs-literate-nav \
mkdocs-git-authors-plugin \
mkdocs-git-revision-date-localized-plugin \
mkdocs-simple-hooks \
mkdocs-git-committers-plugin-2
Make a .github/workflows/build.yml file for deploying in ubuntu server
name: build
on:
push:
branches:
- master
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: ./pip-install.sh
- run: mkdocs gh-deploy --force