AsciiDoc add bold text inside a listing block
Asked Answered
B

3

8

Have some AsciiDoc that has a block like...

----
  this is a test
    with *some* formatted/tabbed text in it
blah
----

...and I would like the text to display like...

  this is a test
    with some formatted/tabbed text in it
blah

...where the word "some" is bold.

Babbitt answered 6/1, 2016 at 19:55 Comment(0)
B
5

Here is what I came up with. This post was helpful...

http://www.methods.co.nz/asciidoc/faq.html#_how_can_i_format_text_inside_a_listing_block

[subs="quotes"]
----
  this is a test
    with *some* formatted/tabbed text in it
blah
----

This allowed me to retain the formatting/whitespace in the text in addition to adding the formatting (bold in this case) to the text.

Babbitt answered 7/1, 2016 at 13:46 Comment(0)
D
5

In AsciiDoc, the double ---- lines signify ListingBlocks, which only preserve certain formatting aspects of your text (line and whitespace formatting), according to the AsciiDoc documentation on Delimited Blocks ( with the exception of using [subs="quotes"], as you noted in your answer).

Other ways to include bold formatting in a delimited block include the "Admonition Block", ExampleBlock, OpenBlock, QuoteBlock, and SidebarBlock options.


Example Blocks:

**Admonition Block:**
[NOTE]
====
here *is* my text
====

**Example Block:**
====
here *is* my text
====

**Open Block:**
--
here *is* my text
--

**Quote Block:**
[quote, quote author]
____
here *is* my text
____

**Sidebar Block:**
****
here *is* my text
****

Example Blocks Output:

Example Blocks Output

Dacosta answered 6/1, 2016 at 20:43 Comment(2)
Thanks summea. I updated the question to better reflect my problem. See my solution below. Please let me know if you have a better way to do this.Babbitt
@Lumbee Nice find with the [subs="quotes"] attribute!Dacosta
B
5

Here is what I came up with. This post was helpful...

http://www.methods.co.nz/asciidoc/faq.html#_how_can_i_format_text_inside_a_listing_block

[subs="quotes"]
----
  this is a test
    with *some* formatted/tabbed text in it
blah
----

This allowed me to retain the formatting/whitespace in the text in addition to adding the formatting (bold in this case) to the text.

Babbitt answered 7/1, 2016 at 13:46 Comment(0)
A
0

As far as I know, this is only possible with docbook code, you can see an example here:

++++
<screen>hostname $ <userinput>date</userinput>
Sun Apr  1 12:34:56 GMT 1984</screen>
++++

Of course, it will only work if your engine was configured with the correcting style for screen and userinput.

Alanalana answered 20/1, 2016 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.