diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-09-01 10:03:10 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-09-01 10:04:20 +0200 |
commit | 469124823c8cb4477816686f56efdeebc79a9044 (patch) | |
tree | 37c473a1ac7e22989bf347d645e8fc5d70e5a0df /markup | |
parent | 96afea4acc7ca8cdfce460127b8ae17e303c77c0 (diff) | |
download | hugo-469124823c8cb4477816686f56efdeebc79a9044.tar.gz hugo-469124823c8cb4477816686f56efdeebc79a9044.zip |
Rename hstring.RenderedHTML => hstring.HTML
And add a comment about why it exists.
Diffstat (limited to 'markup')
-rw-r--r-- | markup/converter/hooks/hooks.go | 8 | ||||
-rw-r--r-- | markup/goldmark/blockquotes/blockquotes.go | 6 | ||||
-rw-r--r-- | markup/goldmark/render_hooks.go | 16 | ||||
-rw-r--r-- | markup/goldmark/tables/tables.go | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/markup/converter/hooks/hooks.go b/markup/converter/hooks/hooks.go index 0232b619f..96c165321 100644 --- a/markup/converter/hooks/hooks.go +++ b/markup/converter/hooks/hooks.go @@ -41,7 +41,7 @@ type LinkContext interface { Title() string // The rendered (HTML) text. - Text() hstring.RenderedHTML + Text() hstring.HTML // The plain variant of Text. PlainText() string @@ -100,7 +100,7 @@ type BlockquoteContext interface { // The blockquote text. // If type is "alert", this will be the alert text. - Text() hstring.RenderedHTML + Text() hstring.HTML /// Returns the blockquote type, one of "regular" and "alert". // Type "alert" indicates that this is a GitHub type alert. @@ -166,7 +166,7 @@ type HeadingContext interface { // Anchor is the HTML id assigned to the heading. Anchor() string // Text is the rendered (HTML) heading text, excluding the heading marker. - Text() hstring.RenderedHTML + Text() hstring.HTML // PlainText is the unrendered version of Text. PlainText() string @@ -213,7 +213,7 @@ const ( type GetRendererFunc func(t RendererType, id any) any type TableCell struct { - Text hstring.RenderedHTML + Text hstring.HTML Alignment string // left, center, or right } diff --git a/markup/goldmark/blockquotes/blockquotes.go b/markup/goldmark/blockquotes/blockquotes.go index f68cccd06..bf1e848b8 100644 --- a/markup/goldmark/blockquotes/blockquotes.go +++ b/markup/goldmark/blockquotes/blockquotes.go @@ -95,7 +95,7 @@ func (r *htmlRenderer) renderBlockquote(w util.BufWriter, src []byte, node ast.N BaseContext: render.NewBaseContext(ctx, renderer, n, src, nil, ordinal), typ: typ, alertType: alertType, - text: hstring.RenderedHTML(text), + text: hstring.HTML(text), AttributesHolder: attributes.New(n.Attributes(), attributes.AttributesOwnerGeneral), } @@ -134,7 +134,7 @@ func (r *htmlRenderer) renderBlockquoteDefault( type blockquoteContext struct { hooks.BaseContext - text hstring.RenderedHTML + text hstring.HTML alertType string typ string @@ -149,7 +149,7 @@ func (c *blockquoteContext) AlertType() string { return c.alertType } -func (c *blockquoteContext) Text() hstring.RenderedHTML { +func (c *blockquoteContext) Text() hstring.HTML { return c.text } diff --git a/markup/goldmark/render_hooks.go b/markup/goldmark/render_hooks.go index d72300434..bacb41a37 100644 --- a/markup/goldmark/render_hooks.go +++ b/markup/goldmark/render_hooks.go @@ -52,7 +52,7 @@ type linkContext struct { pageInner any destination string title string - text hstring.RenderedHTML + text hstring.HTML plainText string *attributes.AttributesHolder } @@ -69,7 +69,7 @@ func (ctx linkContext) PageInner() any { return ctx.pageInner } -func (ctx linkContext) Text() hstring.RenderedHTML { +func (ctx linkContext) Text() hstring.HTML { return ctx.text } @@ -100,7 +100,7 @@ type headingContext struct { pageInner any level int anchor string - text hstring.RenderedHTML + text hstring.HTML plainText string *attributes.AttributesHolder } @@ -121,7 +121,7 @@ func (ctx headingContext) Anchor() string { return ctx.anchor } -func (ctx headingContext) Text() hstring.RenderedHTML { +func (ctx headingContext) Text() hstring.HTML { return ctx.text } @@ -199,7 +199,7 @@ func (r *hookedRenderer) renderImage(w util.BufWriter, source []byte, node ast.N pageInner: pageInner, destination: string(n.Destination), title: string(n.Title), - text: hstring.RenderedHTML(text), + text: hstring.HTML(text), plainText: string(n.Text(source)), AttributesHolder: attributes.New(attrs, attributes.AttributesOwnerGeneral), }, @@ -288,7 +288,7 @@ func (r *hookedRenderer) renderLink(w util.BufWriter, source []byte, node ast.No pageInner: pageInner, destination: string(n.Destination), title: string(n.Title), - text: hstring.RenderedHTML(text), + text: hstring.HTML(text), plainText: string(n.Text(source)), AttributesHolder: attributes.Empty, }, @@ -355,7 +355,7 @@ func (r *hookedRenderer) renderAutoLink(w util.BufWriter, source []byte, node as page: page, pageInner: pageInner, destination: url, - text: hstring.RenderedHTML(label), + text: hstring.HTML(label), plainText: label, AttributesHolder: attributes.Empty, }, @@ -442,7 +442,7 @@ func (r *hookedRenderer) renderHeading(w util.BufWriter, source []byte, node ast pageInner: pageInner, level: n.Level, anchor: string(anchor), - text: hstring.RenderedHTML(text), + text: hstring.HTML(text), plainText: string(n.Text(source)), AttributesHolder: attributes.New(n.Attributes(), attributes.AttributesOwnerGeneral), }, diff --git a/markup/goldmark/tables/tables.go b/markup/goldmark/tables/tables.go index 943da974e..0aa6ee269 100644 --- a/markup/goldmark/tables/tables.go +++ b/markup/goldmark/tables/tables.go @@ -132,7 +132,7 @@ func (r *htmlRenderer) renderCell(w util.BufWriter, source []byte, node ast.Node alignment = "left" } - cell := hooks.TableCell{Text: hstring.RenderedHTML(text), Alignment: alignment} + cell := hooks.TableCell{Text: hstring.HTML(text), Alignment: alignment} if node.Parent().Kind() == gast.KindTableHeader { table.THead[len(table.THead)-1] = append(table.THead[len(table.THead)-1], cell) |