Skip to content

Instantly share code, notes, and snippets.

@ayshptk
Last active October 4, 2023 20:37
Show Gist options
  • Save ayshptk/27602a1796cd88aa81bd70f588357c26 to your computer and use it in GitHub Desktop.
Save ayshptk/27602a1796cd88aa81bd70f588357c26 to your computer and use it in GitHub Desktop.
quickly run this script to generate your github pages beautifully. make sure to switch ages rendering to `docs` folder
# make sure to `pip install markdown` before you run this script :)
# generates beautiful html files in `docs` folder for every markdown file in the root folder
import shutil, markdown, os; shutil.rmtree("docs") if os.path.exists("docs") else None; os.mkdir("docs"); [open("docs/" + file.name.replace(".md", ".html"), "w").write('<link href="https://cdn.statically.io/gh/ayshptk/html.css/main/flavor/white.min.css" rel="stylesheet" >\n<meta name="viewport" content="width=device-width, initial-scale=1.0">\n' + markdown.markdown(file.read())) for file in [open(file, "r") for file in [f for f in os.listdir() if f.endswith(".md")]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment