Difference between literal and listing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference between literal and listing

Thorsten
What's the difference between a literal block and a listing block? The user manual says literal is for "output text" and listing for "keyboard input". Is there any semantical difference?
Reply | Threaded
Open this post in threaded view
|

Re: Difference between literal and listing

mojavelinux
Administrator
Thorsten,

On the surface, not much. It's more of a semantic intent (i.e., a hint).

* I think of a listing as example, non-highlighted code (which is what "keyboard input" is supposed to mean). If you want highlighting, then you add the "source" style.
* I think of a literal as console output from a command or process (e.g., stdout)

If you give the listing-caption attribute a value, then a listing with a title will also get a numbered caption (e.g., Listing 1. Amazing code), whereas a literal with a title will not. 

In the default Asciidoctor stylesheet, listing and literal blocks are styled the same. The difference in styling comes when you add the "source" style to the block.

Sarah and I have had several casual conversations about removing the distinction...and maybe using the literal block syntax for preformatted content and reserving the listing block syntax for open blocks instead so you can have open block delimiters of any length. It's worth discussing, but isn't likely to happen in the Asciidoctor 1.5.0 release.

-Dan


On Wed, Jun 18, 2014 at 10:02 AM, Thorsten [via Asciidoctor :: Discussion] <[hidden email]> wrote:
What's the difference between a literal block and a listing block? The user manual says literal is for "output text" and listing for "keyboard input". Is there any semantical difference?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Difference-between-literal-and-listing-tp1830.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--