From 77e243f232033dadbbcebc2a0b0b168c3ddb88e6 Mon Sep 17 00:00:00 2001 From: treeform Date: Fri, 4 Dec 2020 09:41:28 -0800 Subject: [PATCH] Better readme. --- README.md | 12 ++++++++---- tools/gen_readme.nim | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d18ca5f..92644cc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ This library is being actively developed and is not yet ready for use. Since you ## Examples -### examples/blur.nim +### Blur +[examples/blur.nim](examples/blur.nim) ```nim var p = newPath() p.polygon(100, 100, 70, sides=6) @@ -32,7 +33,8 @@ image.draw(blur) ``` ![example output](examples/blur.png) -### examples/rounded_rectangle.nim +### Rounded rectangle +[examples/rounded_rectangle.nim](examples/rounded_rectangle.nim) ```nim var path = newPath() let @@ -51,7 +53,8 @@ image.fillPath(path, rgba(255, 0, 0, 255)) ``` ![example output](examples/rounded_rectangle.png) -### examples/square.nim +### Square +[examples/square.nim](examples/square.nim) ```nim var p = newPath() p.moveTo(50, 50) @@ -63,7 +66,8 @@ image.fillPath(p, rgba(255, 0, 0, 255)) ``` ![example output](examples/square.png) -### examples/tiger.nim +### Tiger +[examples/tiger.nim](examples/tiger.nim) ```nim var tiger = readImage("examples/data/tiger.svg") image.draw( diff --git a/tools/gen_readme.nim b/tools/gen_readme.nim index 3ab7819..f67ba6e 100644 --- a/tools/gen_readme.nim +++ b/tools/gen_readme.nim @@ -16,7 +16,9 @@ for k, path in walkDir("examples"): let code = readFile(path) let innerCode = code.cutBetween("image.fill(rgba(255, 255, 255, 255))", "image.writeFile") if innerCode != "": - md.add "### " & path.replace("\\", "/") + let path = path.replace("\\", "/") + md.add "### " & path.splitFile().name.replace("_", " ").capitalizeAscii() + md.add "[" & path & "](" & path & ")" md.add "```nim" md.add innerCode.strip() md.add "```"