From c5390463a35060940d6353496c1e58f8793b2678 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Fri, 21 Jul 2023 11:12:09 +0200 Subject: [PATCH] document what happens to the links --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 08e699c..ab2a0d0 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,23 @@ Other constructions: - `{{> template.html}}` sources another template in the place - `{{{something}}}` renders something WITHOUT escaping the HTML special characters (thus allowing injection of HTML code directly) + +### Link processing + +All links in the document (that is, markdown links `[title](url)` and `` +sources) are processed by function `processLink` in `reploy.hs`. The logic of +the processing is as follows: + +- If the link has a reasonable URI scheme (it starts with `http:`, `https:`, + `ftp:` or `mailto:`, it is considered "absolute" and taken as is. +- If the link is an absolute path (starts with a `/`), it is considered to be a + link to a known local page "mount", and it will be changed to precisely point + to a page at that mount. +- If none of the above applies, the link is considered relative. The path is + used to find a file relatively from the dirname of the source markdown file. + The file at that path is then stored in mount + `/files/xxx/yyyyyyyyyyyyy/` (where `xxx` and `yyyy...` are + formed by splitting the 16-character SHA256 hash of the file) and linked + appropriately. This provides a way to store files without the dependency on + the original directory structure, at the same time the hash acts as a cache + buster, and (potentially) a content verification helper.