7

I am using blogdown and kakawait/hugo-tranquilpeak-theme to write a plain markdown blog post. When I add images with the shortcode option tag such as

{{< image classes="fancybox right clear" src="image2.png"     
thumbnail="http://google.fr/images/image125.png" group="group:travel"   
thumbnail-width="150px" thumbnail-height="300px" title="A beautiful    
sunrise" >}}

I am unable to break the title of the image. Now I have

A beautiful image

But I would like

A beautiful 
image

BTW, these breaks:

\n
<br>
<br />

don't work for me. Any idea how to solve this?

prosoitos
  • 6,679
  • 5
  • 27
  • 41
  • I think that you do not want to put a line break in the title of the image, but in the caption of the Fancybox, am I right? – Mr. Hugo Jul 04 '21 at 16:22

2 Answers2

2

We can use Shortcodes to break lines.

Make line_break.html file inside layouts/shortcodes and add <br /> tag to it. So line_break.html file will look like this:

<br />

Now you can use this Shortcode to your markdown file by adding {{< line_break >}}. So in your case, it will look like this:

A beautiful
{{< line_break >}}
image
Rajiv Singh
  • 2,947
  • 2
  • 11
  • 30
0

The HTML5 spec states:

If the title attribute's value contains "LF" (U+000A) characters, the content is split into multiple lines. Each "LF" (U+000A) character represents a line break.

What does your generated HTML look like? Is the line break being stripped out? If so, that is the falt of the tools you are using. You may need to file a bug report.

Waylan
  • 37,164
  • 12
  • 83
  • 109