ccalathea/README.md

56 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2023-01-21 01:33:47 +00:00
# calathea v1.0-beta
2023-01-17 01:13:12 +00:00
calathea is a small C program used to generate static wikis. It takes a
2023-01-17 01:20:25 +00:00
directory of Common Markdown pages with `[[wikilinks]]` and renders them to
2023-01-17 01:13:12 +00:00
HTML. The output is a flat directory of HTML pages where the wikilinks are
converted to relative links.
This is also my first full, complete project written entirely in C, which has
proved to be a serious trial by fire in learning how to effectively work with
zero-terminated strings. There will likely be memoryleaks and comments that
over explain every line of code.
2023-01-21 01:33:47 +00:00
## features
2023-01-20 23:43:53 +00:00
- Rendering wikilinks
- Ability to keep track of incoming links
- Named wikilinks (i.e. `[[link title|actual page]]`)
2023-01-17 01:13:12 +00:00
## installation
This tool requires [cmark](https://github.com/commonmark/cmark) to be
installed. Once that's set up, clone the repository and run:
```
$ make
2023-01-21 01:33:47 +00:00
$ make install
2023-01-17 01:13:12 +00:00
```
If GCC complains it can't find cmark, then try running `ldconfig`. If it
still doesn't work, then run `echo $LD_LIBRARY_PATH`. If it doesn't show
anything, you've got to add the right directory to the path, i.e.,
```
2023-06-20 15:57:17 +00:00
$ export LD_LIBRARY_PATH=/usr/local/lib64
2023-01-17 01:13:12 +00:00
```
Or wherever it got installed as per the output of running `make install` for
cmark.
2023-01-21 01:33:47 +00:00
## usage
To see a list of options, run:
```
$ calathea --help
```
Running calathea builds pages (by default, any filies in `./pages`) to HTML files outputted in the specified output directory (by default, `./build`). To do this, it renders the pages and inserts them into your template file (by default, `./template.html`).
When building the files, calathea will look for two pseudo-Moustache templates: `{{content}}` and `{{incoming}}`. `{{content}}` will be replaced with the page content and `{{incoming}}` will be replaced with an HTML `ul` list of links to all pages that link to the given page.
The first line of every file in your pages directory should just be the title of the page. For example:
```
Page Title
Here is some page content
```
The content of the above page will be "Here is some page content" and the page title will be "Page Title". You can then link to it from other pages with `[[page title]]`.