Asciidoctor Java and the icons

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

Asciidoctor Java and the icons

Hocdoc
I use the Asciidoctor Java integration and it works great, thanks for your work!

My beginner question: I want to render an admonition paragraph (like `TIP:`, `IMPORTANT:`) with an icon on the left side. I have added `:icon:` to the head of my document, but no image link is generated in the HTML when I generate it from Java.

The admonition paragraph gets rendered as `...<.div class="title">Tip</div> ...`. When I call the `asciidoctor` command from the command line, the same paragraph gets rendered like `...<.td class="icon"><.img src="/images/icons/tip.png" alt="Tip"/><./td>...`. (with removed "." after "<")

How can I change the default rendering of AsciiDoc-for-Java to get these icon-links?
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor Java and the icons

LightGuardjp
Alex could probably say for sure, but this is something that is either fixed in 0.1.2.1 or will be in 0.1.3


On Tue, May 21, 2013 at 9:14 AM, Hocdoc [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I use the Asciidoctor Java integration and it works great, thanks for your work!

My beginner question: I want to render an admonition paragraph (like `TIP:`, `IMPORTANT:`) with an icon on the left side. I have added `:icon:` to the head of my document, but no image link is generated in the HTML when I generate it from Java.

The admonition paragraph gets rendered as `...<.div class="title">Tip</div> ...`. When I call the `asciidoctor` command from the command line, the same paragraph gets rendered like `...<.td class="icon"><.img src="/images/icons/tip.png" alt="Tip"/><./td>...`. (with removed "." after "<")

How can I change the default rendering of AsciiDoc-for-Java to get these icon-links?



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



--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor Java and the icons

mojavelinux
Administrator
In reply to this post by Hocdoc
Hocdoc,

There are few things to explain here.

First, the default safe mode when invoking Asciidoctor via the API is SafeMode.SECURE. In secure safe mode, icons cannot be enabled by the document (a security feature). Thus, one way to get this to work is to lower the safe mode level when calling the Asciidoctor API:

String result = asciidoctor.render(source, OptionsBuilder.options().safe(SafeMode.SAFE).asMap());

Another approach is to enable icons for all documents. You can do this by passing the icons attribute to the Asciidoctor API:

String result = asciidoctor.render(source, OptionsBuilder.options().headerFooter(true).attributes(AttributesBuilder.attributes().attribute("icons", "").asMap()).asMap()));

In Asciidoctor 0.1.3, we are working on adding font-based admonition icons so that you don't have to worry about the path to the icons :) They will be enabled by setting:

:icons: font

Here's the issue to track that new feature: https://github.com/asciidoctor/asciidoctor/issues/115

-Dan

On Tue, May 21, 2013 at 9:14 AM, Hocdoc [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I use the Asciidoctor Java integration and it works great, thanks for your work!

My beginner question: I want to render an admonition paragraph (like `TIP:`, `IMPORTANT:`) with an icon on the left side. I have added `:icon:` to the head of my document, but no image link is generated in the HTML when I generate it from Java.

The admonition paragraph gets rendered as `...<.div class="title">Tip</div> ...`. When I call the `asciidoctor` command from the command line, the same paragraph gets rendered like `...<.td class="icon"><.img src="/images/icons/tip.png" alt="Tip"/><./td>...`. (with removed "." after "<")

How can I change the default rendering of AsciiDoc-for-Java to get these icon-links?



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



--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor Java and the icons

Hocdoc
Thanks, I tried the second approach to enable icons for all documents and it works like a charm.
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor Java and the icons

mojavelinux
Administrator
Excellent!

-Dan


On Wed, May 22, 2013 at 1:24 AM, Hocdoc [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks, I tried the second approach to enable icons for all documents and it works like a charm.


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



--
Reply | Threaded
Open this post in threaded view
|

Re: Asciidoctor Java and the icons

asotobu
Thanks Dan for the explanation.