From 0134492489ac70306486678aae81192d9cc0228d Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 4 Jul 2024 17:36:48 +0200 Subject: Split gemtext function output into Body and Title --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 092f348..a914f51 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,20 @@ templates { } ``` -See the `template.localhost` virtual host in `example/Caddyfile` for an example -of using the `gemtext` template to render a gemtext file within an HTML file. +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: + +* `Body`: The result of converting each line of the input string into an + equivalent line of HTML. This will not include any wrapping HTML tags like + `
` or ``. + +* `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 -- cgit v1.2.3