Paul,
As always, there are a couple of ways to skin this cat (or shave this yak, whichever metaphor you prefer).
First, I'll explain why you see the output you see.
While it's true that a space followed by a plus at the end of the line marks a hard line break, that gets superseded by the rule that a space at the beginning of creates a literal paragraph. Literal paragraphs and blocks don't get the hard line break substitution, so that explains why the + remains in the output.
In the case of the verse, you get plus characters in the output because a verse is also treated as literal text and therefore doesn't get hard line break substitutions either (since the text is already displayed as preformatted).
Attributes to the rescue!
This is a prime example of when you would use attributes as fillers. There are a couple of attributes that apply here.
You could use a non-breaking space to start the line:
{nbsp} +
{nbsp} +
or a regular space:
{sp} +
{sp} +
The only downside in these cases is that you get a physical space in the output (that is selectable via a mouse). Instead, you can use a zero-width space:
{zwsp} +
{zwsp} +
That will give you the following output:
<div class="paragraph"><p>​<br>
​<br></p></div>
But the best solution is no space at all. For that, there's the empty attribute:
{empty} +
{empty} +
That gives you exactly the output you want:
<div class="paragraph"><p><br>
<br></p></div>
If you want to make this more semantic you can define an attribute as an alias for this line:
:blank: {empty} +
:blank: {empty} +
Now you can type:
{blank}
{blank}
Voila!. You get the same output.
(Btw, blank would be a nice built-in attribute to have, don't you think?).
For completeness, I'll mention the solution w/ verse:
If you want to use the verse block, you can use the zero-width space by itself:
[verse]
{zwsp}
{zwsp}
That will give you the output:
<div class="verseblock">
<pre class="content">​
​</pre>
<div class="attribution">
</div></div>
I like the first option better of using {blank} in the context of a normal paragraph.
There may be other solutions, but that should get you started!
-Dan
On Fri, Mar 15, 2013 at 11:16 AM, paulrayner [via Asciidoctor :: Discussion]
<[hidden email]> wrote:
How do I do blank lines in AsciiDoc so that they will come out correctly in Asciidoctor HTML rendering?
A plus character preceded by at least one space character at the end of a non-blank line forces a line break. It generates a line break (br
) tag for HTML outputs and a custom XML asciidoc-br
processing instruction for DocBook outputs. The asciidoc-br
processing instruction is handled bya2x(1)
.
With AsciiDoc of:
+
I get:
<div class="literalblock">
<div class="content monospaced">
<pre>+</pre>
</div>
</div>
But I get HTML that looks like the following from Asciidoctor:
<div class="literalblock">
<div class="content monospaced">
<pre>+
+</pre>
</div>
</div>
Am I missing something here?
Thanks,
Paul.
--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597