Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitca7df13f7f2464892e2ed208e3b2eaf4e72a2ef4 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-01-01 17:18:15 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-01-01 17:18:15 +0200
Files30d349a9d60f30a78a0109aefdf79273aadaacd0
csg-ca7df13f7f2464892e2ed208e3b2eaf4e72a2ef4.tar
csg-ca7df13f7f2464892e2ed208e3b2eaf4e72a2ef4.tar.gz
csg-ca7df13f7f2464892e2ed208e3b2eaf4e72a2ef4.zip
Parent03a882950ead37f74ab4953dbd1199ddbc3d7f6c (diff)
feat(README): Update contents
1 files changed, 42 insertions, 109 deletions
-rw-r--r--README.md151
diff --git a/README.md b/README.md
index 1791830..9f90243 100644
--- a/README.md
+++ b/README.md
@@ -1,129 +1,62 @@
# csg
csg is the "complicated (static) site generator".
-It's a somewhat simple static site generator, written in a shell script, with many "poweruser" features thanks to [awk](TODO).
-The shell script and underlying awk scripts are POSIX compatible.
+It's a Markdown-based static site generator, which aims to be simple, small, extensible and fully POSIX-compliant.
-The overall design is heavily inspired by [Roman Zolotarev](https://romanzolotarev.com/)'s [ssg](https://romanzolotarev.com/ssg.html), however the codebase is completely different, with the added bonus of:
+The primary provided features are:
-- arbitrary file modifications via awk
-- git-based "created" and "edited" timestamps
-- support for (multiple) description and title meta tags
-- support for custom title format
+- Markdown conversion, supporting [the original spec](https://daringfireball.net/projects/markdown/syntax) and some common extensions like nested lists or fenced code-blocks
+- Customizing the Markdown conversion, allowing you to add elements around blocks
+- Customizing the resultant HTML with access to a variety of variables, including:
+ - word count
+ - (optional) git-based "created" and "edited" timestamps
+- Page title and description, based on document and user-customizable format string
-## How to use (for the layman)
+## Getting started
-Inside a "source" folder you put your content, structured in any way.
-Your webpages are written in Markdown and must end with `.md`.
-You'll also need to have a `_header.html` and `_footer.html`, both of those will be slapped on the top and bottom of your Markdown pages.
-Then run:
+TODO
-```bash
-csg './source' './destination' '& - You' 'https://you.com'
-```
+## Documentation
-- './source' is your source folder
-- './destination' is where you want your generated website to go
-- '& - You' is the format of your title, `&` takes the first `h1` from the page and puts it in, with `\\&` you can put an actual ampersand
-- 'https://you.com' is your website
+TODO
-If you want to use awk scripts for extended functionality, put them in a folder and reference it at the end of the command:
+## Limitations and alternatives
-```bash
-csg './source' './destination' '& - You' 'https://you.com' './awk-scripts'
-```
+The biggest bottleneck when using csg is the AWK-based Markdown converter.
+sed isn't powerful enough for the task and POSIX-compliant C will result in enormous code.
-### Demo
+From my research, only one other person has worked on an AWK-based converter: [Jesús Galán López](https://github.com/yiyus). His converter, [md2html.awk](https://github.com/yiyus/md2html.awk), supports only a subset of Markdown and, in my subjective opinion, isn't at all simple or extensible (though it may be faster).
-This repository comes with a small demo setup.
-To test it out, run:
+However, it has been used in multiple other POSIX-compliant site generators:
-```bash
-./csg ./demo/src ./demo/website '& - Demo' ./demo/awk-edits
-```
+- [zodiac](https://github.com/nuex/zodiac) by [Chase James](https://github.com/nuex)
+- [simple-static](https://github.com/wlangstroth/simple-static) by [Will Langstroth](https://github.com/wlangstroth)
+- [mksite](https://github.com/clehner/mksite) by [Charles Lehner](https://github.com/clehner)
-You will find your website, ready to be served, inside `./demo/website`.
+Other POSIX-compliant site generators:
-## Regarding awk
+|Name|Author|Page markup|Parser|
+|----|------|-----------|------|
+|[ssg](https://romanzolotarev.com/ssg.html)|[Roman Zolotarev](https://romanzolotarev.com/)|Markdown|(external)|
+|[rawk](https://github.com/kisom/rawk)|[Kyle Isom](https://github.com/kisom)|Markdown|(external)|
+|[Pharox](https://phraxos.caffeine.computer/)|[caffeine](https://caffeine.computer/)|HTML|-|
+|[makesite](https://github.com/straumer/makesite)|[Matthías Ragnarsson](https://github.com/straumer)|HTML|-|
+|[suna](https://github.com/fuku77/suna)|[fuku77](https://github.com/fuku77)|Markdown|[interpreter](https://github.com/fuku77/suna/blob/main/.suna/interpreter), small subset of Markdown|
+|[dwfwb](https://github.com/fault2004/dwfweb)|[Supphakit Duanghoy](https://github.com/fault2004/dwfweb)|[smu](https://github.com/Gottox/smu)|(external)|
-Additional features are available with [awk](TODO).
-By default, the title, description, word count, date created and date edited are taken from every Markdown file.
-The title and description will be put in place of `[TITLE]` and `[DESCRIPTION]` inside `_header.html`.
-You can also create/use your own awk scripts for further page modification (all variables will also be available inside those scripts).
+Other shell (probably bash) site generators:
-### Writing your own scripts
+|Name|Author|Page markup|Parser|
+|----|------|-----------|------|
+|[sw](https://github.com/jroimartin/sw)|[Roi Martin](https://github.com/jroimartin)|HTML|-|
+|[dsw](https://github.com/dfr62)|[Dan Rinaldi](https://github.com/dfr62)|Any|(external)|
+|[bashblog](https://github.com/cfenollosa/bashblog)|[Carlos Fenollosa](https://github.com/cfenollosa)|Markdown|(external)|
+|[utterson](https://github.com/stef/utterson)|[Stefan Marsiske](https://github.com/stef)|HTML|-|
+|[vee](https://git.sdf.org/pifty/vee)|[pifty](https://git.sdf.org/pifty)|TXT|-|
+|[NanoBlogger](https://nanoblogger.sourceforge.net/)|n1xt3r|HTML|-|
+|[simsalabash](https://github.com/markusfisch/simsalabash)|[Markus Fisch](https://github.com/markusfisch)|HTML|-|
+|[statix](https://gist.github.com/plugnburn/c2f7cc3807e8934b179e)|[plugnburn](https://gist.github.com/plugnburn)|HTML|-|
-There are some things you must consider while creating an awk script:
+Most work directly with HTML or use an external Markdown parser.
-1. It will be ran on the generated HTML pages
-2. It's name **must** start with a capital letter
- - You can also create so-called "libraries", mainly awk scripts with only function definitions
- - libraries **must** start with a `#` character in their name, and are included with every script
-3. The current line **mustn't** be printed (unless you want to add a line to the file)
- - With awk we can modify only certain lines, but the easiest way to get the whole file with the modified lines, is to just print every line.
- Such a rule is "appended" to the end of your script.
- - Do modifications to `$0` instead of `print (fancy expression)`
- - If you don't want to print a line, do `$0 = 0`
-4. Every script **must** begin with a `# regex` line
- - For optimisation purposes, a script is ran only on the files which match the given regular expression
- - The regex is on the whole path, so you could make changes (for example) to specific pages or all pages inside folders
- - The regular expression is fed to `find -regex`, so for exact support view `find`'s documentation
-5. Script variables **mustn't** collide and you **mustn't** use `exit` or `nextfile`
- - Also for optimisation purposes, scripts with the same regex are combined into one
-6. Inside your scripts you'll have the `title`, `description`, `words`, `created` and `edited` variables available
- The last two will be dates in the format "%d %B %Y", and are only available if your website uses git.
-
-## Usage of the script
-
-csg comes with a help message, which contains everything you might want to know for running the script:
-
-```
-Usage: csg [-h | -? | --help]
- csg <source_dir> <destination_dir> <title_format> <base_url> [<scripts_dir>]
-
-Options:
- -h, -?, --help Print this help message (also available when given no
- arguments)
-
-Arguments:
- <source_dir> Folder which contains source files
- <destination_dir> Folder in which the generated site will be put
- <title_format> Format string for page title
- Accepts any text or HTML, & is replaced with contents
- title (first h1 header).
- <base_url> Base URL of your website (scheme + authority), without
- trailing "/", used for sitemap generation.
- Example: https://google.com
- <scripts_dir> Optional, folder which contains awk script for editing of
- generated webpages.
-
-Variables (you can predefine):
- CSG_TIMESTAMP_FILE File path for git-based timestamps (when git exists)
- Default: "./timestamps.txt"
- Disable: ""
- CSG_TMP_DIR Directory to put temporary files
- Default: "/tmp"
- CSG_AWK awk executable and flags
- Default: searches for gawk
- CSG_MD_TO_HTML Program to convert Markdown to HTML and it'\''s flags
- Default: searches for lowdown
-
-Dependencies (required):
- bash, printf, find, cpio
-
-
-csg - complicated (static) site generator
-Created by Syndamia, https://gitlab.com/Syndamia/csg
-```
-
-## Future features
-
-1. The way awk scripts are integrated and ordered is somewhat messy and needs major rethinking.
- Ideally you should be able to run an awk script on the markdown, on the markdown generated html (as is already done) and on all final HTML pages (so you could create a list of latest articles with certain excerpts from them, for example).
- There is also the need to be able to reorder script execution easily, without script modifications (so when using someone else's script, you dont need to change it, hence you can include it with a git submodule or sync it with rsync).
- - The regex on top of awk scrits is for optimization purposes, but maybe this new system should be able to figure out when a script needs to be ran?
-2. Right now the whole website is regenerated every time, it's important to add a system for updating only the currently changed pages.
- I'm not entirely sure how to do that, since we remove the source Markdown after it is converted to HTML, current thinking leads me to a file containing lines of "filepath hash", but we'll see.
-3. Timestamps.txt but based on created/edited file stats
-4. Need to add a `_ignore` file to not convert certain folders
-5. Add native support for more awk parsers and markdown to html converters
+A really good C-based parser is [lowdown](https://kristaps.bsd.lv/lowdown/) by [Kristaps Dzonsons](https://github.com/kristapsdz).