You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Draw text line by line, breaking each line at the maximum width.f.text=strings.ReplaceAll(f.text, "\r", "")
for_, line:=rangestrings.Split(f.text, "\n") {
for_, str:=rangestrings.Fields(line) {
strWidth:=font.MeasureString(face, str)
if (d.Dot.X.Ceil() +strWidth.Ceil()) >=maxWidth {
y=y+fontHeight+f.linespacingd.Dot=fixed.P(f.x, y)
}
d.DrawString(str+" ")
}
y=y+fontHeight+f.linespacingd.Dot=fixed.P(f.x, y)
}
This would allow you to overlay this:
{{ $text := "This is a list:\n\n1. Item one\n2. Item two" }}
With this result:
Instead of this:
The text was updated successfully, but these errors were encountered:
Reference: https://discourse.gohugo.io/t/render-markdown-with-newlines-in-shortcode/48684
This simple approach to word wrapping eats newlines:
hugo/resources/images/text.go
Lines 94 to 103 in b1de03f
Suggest something like this instead:
This would allow you to overlay this:
With this result:
Instead of this:
The text was updated successfully, but these errors were encountered: