Add footnote extension support
This commit is contained in:
parent
6dff989116
commit
2ee7b67ab5
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ build:
|
|||
./build.py
|
||||
|
||||
watch:
|
||||
while sleep 1 0; do find src/ build Makefile | entr -d make build; done
|
||||
while sleep 1; do find src/ build.py Makefile | entr -d make build; done
|
||||
|
||||
serve:
|
||||
python -m http.server --directory out/
|
||||
|
|
7
build.py
7
build.py
|
@ -19,7 +19,7 @@ def main():
|
|||
src = pathlib.Path(args.src).absolute()
|
||||
out = pathlib.Path(args.out).absolute()
|
||||
|
||||
md = markdown.Markdown(extensions=["attr_list", "meta"])
|
||||
md = markdown.Markdown(extensions=["attr_list", "footnotes", "meta"])
|
||||
|
||||
# Clean the output directory
|
||||
if out.exists():
|
||||
|
@ -33,10 +33,12 @@ def main():
|
|||
|
||||
# cd to src so os.walk(.) returns paths relative to src
|
||||
os.chdir(src)
|
||||
count = 0
|
||||
for dirpath, dirnames, filenames in os.walk("."):
|
||||
for filename in filenames:
|
||||
if filename[0] == ".":
|
||||
continue # Skip dotfiles
|
||||
count += 1
|
||||
|
||||
# Future-proofing
|
||||
if not filename.endswith(".html") and not filename.endswith(".md"):
|
||||
|
@ -52,6 +54,7 @@ def main():
|
|||
# Preprocess markdown into html
|
||||
if dest.name.endswith(".md"):
|
||||
print("Converting", path)
|
||||
md.reset()
|
||||
dest = dest.with_suffix(".html")
|
||||
content = md.convert(content)
|
||||
meta = md.Meta
|
||||
|
@ -73,6 +76,8 @@ def main():
|
|||
print("Writing ", dest)
|
||||
dest.write_text(str(page))
|
||||
|
||||
print("Processed", count, "files")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Untitled Page</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
max-width: 100ch;
|
||||
|
|
Loading…
Reference in New Issue