Add HTML widget

This commit is contained in:
Svilen Markov
2024-06-02 19:01:20 +01:00
parent e8043be107
commit 75079a981b
3 changed files with 36 additions and 0 deletions

20
internal/widget/html.go Normal file
View File

@@ -0,0 +1,20 @@
package widget
import (
"html/template"
)
type HTML struct {
widgetBase `yaml:",inline"`
Source template.HTML `yaml:"source"`
}
func (widget *HTML) Initialize() error {
widget.withTitle("").withError(nil)
return nil
}
func (widget *HTML) Render() template.HTML {
return widget.Source
}

View File

@@ -27,6 +27,8 @@ func New(widgetType string) (Widget, error) {
return &Bookmarks{}, nil
case "iframe":
return &IFrame{}, nil
case "html":
return &HTML{}, nil
case "hacker-news":
return &HackerNews{}, nil
case "releases":