Login  Register

Adding a character before a numbered list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Adding a character before a numbered list

Chuck
I was just chatting with a coworker and he was asking about adding a character before a number in a numbered list.

In this instance he wants to have the list be numbered and prefixed by a paragraph symbol as shown here:

¶1 The first Paragraph

¶2 The second paragraph

I didn't see anything in the manual about how this might be possible, but I was wondering if there might be an  undocumented feature, a script or some other coding trick to make this happen.
Ted
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Adding a character before a numbered list

Ted
Use a docinfo file to add the CSS to your list items.

myTest.adoc file
= Test Paragraphs
:icons: font
:docinfo1:

Test styling the following list:

. The first Paragraph
. The second paragraph


docinfo.html file
<style type="text/css"> ol { counter-reset: item } li { display: block } li:before { content: "¶ " counter(item); counter-increment: item } </style>
- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Adding a character before a numbered list

Chuck
Thanks Ted. That did exactly what I wanted for HTML output.

One more question if you happen to know. Is there an equivalent option for generating PDFs?
Ted
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Adding a character before a numbered list

Ted
You'll need to install "asciidoctor-pdf"

How to: http://asciidoctor.org/docs/convert-asciidoc-to-pdf/


I could not get the paragraph symbol to prefix the listitems when rendering myTest.adoc to PDF. But you could probably make the CSS work by creating your own PDF theme in a YAML file. How to: https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc


- Ted @TedAtCIS