NAME
lowdown.cgi
,
lowdown-gemini.cgi
— CGI
wrappers around lowdown
DESCRIPTION
The lowdown.cgi
program generates HTML and
Gemtext documents from Markdown using lowdown(1).
INSTALLING
- Install lowdown
- Clone this repository:
$ git clone git://sysrq.in:/lowdown.cgi /var/www/mysite
or add it as a submodule:
$ git submodule add git://sysrq.in:/lowdown.cgi $ ln -s ./lowdown.cgi/cgi-bin cgi-bin
- Setup your web and/or gemini server (see ENVIRONMENT and EXAMPLES).
ENVIRONMENT
LOWDOWN_OPTS
- Options for lowdown(1).
MARKDOWN_FILENAME
- Absolute path to a Markdown file. If unset,
‘
$PATH_TRANSLATED
’ is used for Gemini and ‘$DOCUMENT_ROOT$DOCUMENT_URI
’ for web.
FILES
The lowdown.cgi
program uses the following
files if they can be found in the same directory as
$MARKDOWN_FILENAME
:
- header.html, header.gmi
- Some text to be displayed before rendered Markdown article.
- footer.html, footer.gmi
- Some text to be displayed after rendered Markdown article.
Use lowdown's --out-standalone
option if
you don't need custom header or footer.
EXIT STATUS
The lowdown.cgi
utility exits 0 on
success, and >0 if an error occurs.
EXAMPLES
Example directory layout
/var/www ├── cgi-bin │ └── ... ├── blog │ ├── footer.html -> /var/www/footer.html │ ├── header.html │ └── index.md ├── htdocs │ ├── icon.png │ └── styles.css ├── about.md ├── footer.html ├── header.html ├── index.md └── lowdown_params
Example Nginx configuration
location / { root /var/www/htdocs; try_files $uri @lowdown; } location @lowdown { root /var/www; set $fn $document_root$document_uri; if (-d $fn) { set $fn $fn/index.md; } if (!-f $fn) { return 404; } include fastcgi_params; fastcgi_param MARKDOWN_FILENAME $fn; fastcgi_param SCRIPT_FILENAME $document_root/cgi-bin/lowdown.cgi; fastcgi_pass unix:/run/fcgiwrap.sock-1; } location /sitemap.xml { root /var/www; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/cgi-bin/sitemap.cgi; fastcgi_pass unix:/run/fcgiwrap.sock-1; }