diff options
author | Brian Picciano <me@mediocregopher.com> | 2024-07-04 18:25:17 +0200 |
---|---|---|
committer | Brian Picciano <me@mediocregopher.com> | 2024-07-04 18:30:00 +0200 |
commit | c9d28a108d6df59a895dd10f47e834ceba20f98a (patch) | |
tree | c8c5b31b647626782f7bea8d6a6fa5bd74f7bf28 /README.md | |
parent | 0134492489ac70306486678aae81192d9cc0228d (diff) |
Add gateway_url parameter in gemtext template
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 43 |
1 files changed, 35 insertions, 8 deletions
@@ -20,11 +20,45 @@ function][mdfunc] in its usage. It can be enabled by being included in the ```text templates { extensions { - gemtext + gemtext { + # All parameters are optional + gateway_url "https://some.gateway/x/" + } } } ``` +See the `template.localhost` virtual host in `example/Caddyfile`, and the +associated `example/tpl/render_gemtext.html` template file, for an example of +how to use this directive. + +[gemtext]: https://geminiprotocol.net/docs/gemtext.gmi +[mdfunc]: https://caddyserver.com/docs/modules/http.handlers.templates#markdown + +#### Parameters + +Optional parameters to the gemtext extension include: + +**gateway_url** + +If given then any `gemini://` URLs encountered as links within +the document will be appended to this URL, having their `gemini://` scheme +stripped off first. + +e.g. if `gateway_url` is `https://some.gateway/x/` then the following line: + +```text +=> gemini://geminiprotocol.net Check it out! +``` + +becomes + +```html +<a href="https://some.gateway/x/geminiprotocol.net">Check it out!</a> +``` + +#### Template function + Within a template being rendered the `gemtext` function will be available and can be passed any string. The function will return a struct with the following fields: @@ -36,13 +70,6 @@ fields: * `Title`: A suggested title, based on the first `# Header` line found in the gemtext input. -See the `template.localhost` virtual host in `example/Caddyfile`, and the -associated `example/tpl/render_gemtext.html` template file, for an example of -how to use the template function. - -[gemtext]: https://geminiprotocol.net/docs/gemtext.gmi -[mdfunc]: https://caddyserver.com/docs/modules/http.handlers.templates#markdown - ## Development A nix-based development environment is provided with the correct versions of all |