How do I do blank lines in AsciiDoc so that they will come out correctly in Asciidoctor HTML rendering? According to http://www.methods.co.nz/asciidoc/chunked/ch10.html:
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 ( With AsciiDoc of: + I get: <div class="literalblock"> <div class="content monospaced">
<pre>+</pre> </div> </div> I tried doing a verse paragraph style, with lines consisting of a space and plus sign per http://comments.gmane.org/gmane.text.formats.asciidoc/224:
[verse] + + This is based on the docs here: http://www.methods.co.nz/asciidoc/chunked/ch15.html#X94
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.
|
Administrator
|
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:
Dan Allen Principal Software Engineer, Red Hat | Author of Seam in ActionRegistered Linux User #231597 |
Administrator
|
In reply to this post by paulrayner
I'll turn this into a wiki page.
-Dan
On Fri, Mar 15, 2013 at 12:56 PM, Dan Allen <[hidden email]> wrote: Paul, Dan Allen Principal Software Engineer, Red Hat | Author of Seam in ActionRegistered Linux User #231597 |
Administrator
|
In reply to this post by paulrayner
https://github.com/asciidoctor/asciidoctor/wiki/How-to-insert-sequential-blank-lines
On Fri, Mar 15, 2013 at 12:57 PM, Dan Allen <[hidden email]> wrote: I'll turn this into a wiki page. Dan Allen Principal Software Engineer, Red Hat | Author of Seam in ActionRegistered Linux User #231597 |
Free forum by Nabble | Edit this page |