From c9d28a108d6df59a895dd10f47e834ceba20f98a Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 4 Jul 2024 18:25:17 +0200 Subject: Add gateway_url parameter in gemtext template --- README.md | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index a914f51..30a3285 100644 --- a/README.md +++ b/README.md @@ -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 +Check it out! +``` + +#### 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 -- cgit v1.2.3