aboutsummaryrefslogtreecommitdiffhomepage
path: root/markup
diff options
context:
space:
mode:
Diffstat (limited to 'markup')
-rw-r--r--markup/converter/hooks/hooks.go8
-rw-r--r--markup/goldmark/blockquotes/blockquotes.go6
-rw-r--r--markup/goldmark/blockquotes/blockquotes_integration_test.go4
-rw-r--r--markup/goldmark/goldmark_integration_test.go12
-rw-r--r--markup/goldmark/render_hooks.go16
-rw-r--r--markup/goldmark/tables/tables.go2
-rw-r--r--markup/goldmark/tables/tables_integration_test.go4
7 files changed, 26 insertions, 26 deletions
diff --git a/markup/converter/hooks/hooks.go b/markup/converter/hooks/hooks.go
index 9487fd0a7..0232b619f 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.RenderedString
+ Text() hstring.RenderedHTML
// 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.RenderedString
+ Text() hstring.RenderedHTML
/// 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.RenderedString
+ Text() hstring.RenderedHTML
// 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.RenderedString
+ Text hstring.RenderedHTML
Alignment string // left, center, or right
}
diff --git a/markup/goldmark/blockquotes/blockquotes.go b/markup/goldmark/blockquotes/blockquotes.go
index a261ec4fe..f68cccd06 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.RenderedString(text),
+ text: hstring.RenderedHTML(text),
AttributesHolder: attributes.New(n.Attributes(), attributes.AttributesOwnerGeneral),
}
@@ -134,7 +134,7 @@ func (r *htmlRenderer) renderBlockquoteDefault(
type blockquoteContext struct {
hooks.BaseContext
- text hstring.RenderedString
+ text hstring.RenderedHTML
alertType string
typ string
@@ -149,7 +149,7 @@ func (c *blockquoteContext) AlertType() string {
return c.alertType
}
-func (c *blockquoteContext) Text() hstring.RenderedString {
+func (c *blockquoteContext) Text() hstring.RenderedHTML {
return c.text
}
diff --git a/markup/goldmark/blockquotes/blockquotes_integration_test.go b/markup/goldmark/blockquotes/blockquotes_integration_test.go
index e4447e5e9..f12600b42 100644
--- a/markup/goldmark/blockquotes/blockquotes_integration_test.go
+++ b/markup/goldmark/blockquotes/blockquotes_integration_test.go
@@ -32,9 +32,9 @@ func TestBlockquoteHook(t *testing.T) {
block = true
title = true
-- layouts/_default/_markup/render-blockquote.html --
-Blockquote: |{{ .Text | safeHTML }}|{{ .Type }}|
+Blockquote: |{{ .Text }}|{{ .Type }}|
-- layouts/_default/_markup/render-blockquote-alert.html --
-{{ $text := .Text | safeHTML }}
+{{ $text := .Text }}
Blockquote Alert: |{{ $text }}|{{ .Type }}|
Blockquote Alert Attributes: |{{ $text }}|{{ .Attributes }}|
Blockquote Alert Page: |{{ $text }}|{{ .Page.Title }}|{{ .PageInner.Title }}|
diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go
index 19338310c..c691435ee 100644
--- a/markup/goldmark/goldmark_integration_test.go
+++ b/markup/goldmark/goldmark_integration_test.go
@@ -76,7 +76,7 @@ title: "p1"
{{- range $k, $v := .Attributes -}}
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
{{- end -}}
->{{ .Text | safeHTML }}</h{{ .Level }}>
+>{{ .Text }}</h{{ .Level }}>
`
b := hugolib.Test(t, files)
@@ -146,11 +146,11 @@ title: "p1"
{{ .Content }}
-- layouts/_default/_markup/render-heading.html --
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
- {{ .Text | safeHTML }}
+ {{ .Text }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
-- layouts/_default/_markup/render-link.html --
-<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
+<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
`
@@ -236,11 +236,11 @@ func BenchmarkRenderHooks(b *testing.B) {
-- config.toml --
-- layouts/_default/_markup/render-heading.html --
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
- {{ .Text | safeHTML }}
+ {{ .Text }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
-- layouts/_default/_markup/render-link.html --
-<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
+<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
-- layouts/_default/single.html --
{{ .Content }}
`
@@ -452,7 +452,7 @@ Link https procol: https://www.example.org
if withHook {
files += `-- layouts/_default/_markup/render-link.html --
-<a href="{{ .Destination | safeURL }}">{{ .Text | safeHTML }}</a>`
+<a href="{{ .Destination | safeURL }}">{{ .Text }}</a>`
}
return hugolib.NewIntegrationTestBuilder(
diff --git a/markup/goldmark/render_hooks.go b/markup/goldmark/render_hooks.go
index 790b2f4ca..d72300434 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.RenderedString
+ text hstring.RenderedHTML
plainText string
*attributes.AttributesHolder
}
@@ -69,7 +69,7 @@ func (ctx linkContext) PageInner() any {
return ctx.pageInner
}
-func (ctx linkContext) Text() hstring.RenderedString {
+func (ctx linkContext) Text() hstring.RenderedHTML {
return ctx.text
}
@@ -100,7 +100,7 @@ type headingContext struct {
pageInner any
level int
anchor string
- text hstring.RenderedString
+ text hstring.RenderedHTML
plainText string
*attributes.AttributesHolder
}
@@ -121,7 +121,7 @@ func (ctx headingContext) Anchor() string {
return ctx.anchor
}
-func (ctx headingContext) Text() hstring.RenderedString {
+func (ctx headingContext) Text() hstring.RenderedHTML {
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.RenderedString(text),
+ text: hstring.RenderedHTML(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.RenderedString(text),
+ text: hstring.RenderedHTML(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.RenderedString(label),
+ text: hstring.RenderedHTML(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.RenderedString(text),
+ text: hstring.RenderedHTML(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 61c9b893f..943da974e 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.RenderedString(text), Alignment: alignment}
+ cell := hooks.TableCell{Text: hstring.RenderedHTML(text), Alignment: alignment}
if node.Parent().Kind() == gast.KindTableHeader {
table.THead[len(table.THead)-1] = append(table.THead[len(table.THead)-1], cell)
diff --git a/markup/goldmark/tables/tables_integration_test.go b/markup/goldmark/tables/tables_integration_test.go
index 8055265c8..dadce5c81 100644
--- a/markup/goldmark/tables/tables_integration_test.go
+++ b/markup/goldmark/tables/tables_integration_test.go
@@ -32,7 +32,7 @@ title = true
| Item | In Stock | Price |
| :---------------- | :------: | ----: |
| Python Hat | True | 23.99 |
-| SQL Hat | True | 23.99 |
+| SQL **Hat** | True | 23.99 |
| Codecademy Tee | False | 19.99 |
| Codecademy Hoodie | False | 42.99 |
{.foo foo="bar"}
@@ -61,7 +61,7 @@ Attributes: {{ .Attributes }}|
b.AssertFileContent("public/p1/index.html",
"Attributes: map[class:foo foo:bar]|",
"table-0-thead: 0: 0: left: Item| 1: center: In Stock| 2: right: Price|$",
- "table-0-tbody: 0: 0: left: Python Hat| 1: center: True| 2: right: 23.99| 1: 0: left: SQL Hat| 1: center: True| 2: right: 23.99| 2: 0: left: Codecademy Tee| 1: center: False| 2: right: 19.99| 3: 0: left: Codecademy Hoodie| 1: center: False| 2: right: 42.99|$",
+ "table-0-tbody: 0: 0: left: Python Hat| 1: center: True| 2: right: 23.99| 1: 0: left: SQL <strong>Hat</strong>| 1: center: True| 2: right: 23.99| 2: 0: left: Codecademy Tee| 1: center: False| 2: right: 19.99| 3: 0: left: Codecademy Hoodie| 1: center: False| 2: right: 42.99|$",
)
b.AssertFileContent("public/p1/index.html",