Return errors properly from gmi2html

This commit is contained in:
2025-03-02 15:00:01 +02:00
parent 47340aebb8
commit f78a89c56c
4 changed files with 10 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ import (
// Based on https://geminiprotocol.net/docs/gemtext-specification.gmi
// Gmi2html converts Gemini text to HTML with proper escaping and wraps it in a container with typography-focused CSS
func Gmi2html(text string, title string) string {
func Gmi2html(text string, title string) (string, error) {
content := convertGeminiContent(text)
// Handle any template errors with container
@@ -26,10 +26,10 @@ func Gmi2html(text string, title string) string {
})
if err != nil {
fmt.Printf("Error executing container template: %s\n", err)
return ""
return "", err
}
return buffer.String()
return buffer.String(), nil
}
// convertGeminiContent converts Gemini text to HTML with proper escaping