HUGO

How do I specify a new line (not new paragraph) in markdown?

I’m likely missing something silly. The following does not produce new lines between the last 3 lines as I’d expect (I can do paragraphs if I add empty lines in between them, but don’t want paragraphs):

---
title: About Us
subtitle: >-
  The X Foundation was created in 2017 by ...

layout: page
---

## People

Foo Bar (Founder),
Bruce Lee,
Tupak Amaru

The above is rendered by {{ .Content }}, specifically:

{{ define "content" }}

<div class="outer">
  <div class="inner-medium">

    <article class="post post-full">
      <header class="post-header">
        <h1 class="post-title">{{ .Params.title }}</h1>
      </header><!-- .post-header -->
      {{ if .Params.image }}
      <div class="post-thumbnail">
        <img src="{{ .Params.image | relURL }}" alt="{{ .Params.title }}" />
      </div><!-- .post-thumbnail -->
      {{ end }}
      {{ if .Params.subtitle }}
      <div class="post-subtitle">
        {{ .Params.subtitle | safeHTML }}
      </div><!-- .post-subtitle -->
      {{ end }}
      <div class="post-content">
        {{ .Content }}
      </div><!-- .post-content -->
    </article><!-- .post -->

  </div><!-- .inner-medium -->
</div><!-- .outer-->

{{ end }}

You can add two spaces to the end of each line, but your editor might be configured to strip trailing spaces on save. The other option is to end each line with a backslash \.

See https://spec.commonmark.org/0.29/#hard-line-breaks

Many thanks! I was resorting to a rawhtml shortcode which i felt was way too overkill.

You also could insert HTML, which should work in any Markdown editor:

<p>&nbsp;</>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.