Embedded style not being rendered in java

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

Embedded style not being rendered in java

jasjeetkaur
Hi,

So I have a .adoc document, that I am rendering as html using java APIs. But the styling is not getting rendered. I have tried using :linkcss: as well as the following.

:stylesdir: mystylesheets/
:stylesheet: mystyles.css

But still there is no styling in my rendered page.

My code is as follows: Attributes attributes = new Attributes();
       
        Options options = new Options();
        options.setAttributes(attributes);
        options.setInPlace(true);

        router.get("/readme.html").handler( ctx -> {
            String html = asciidoctor.convert(
                    getDocFileContent(),
                    options);
            ctx.response().end(html);
        });


I am using a sample readme.adoc file, the content is getting loaded, but the default embedded styling is not rendered. Can somebody please help  me regarding this.

My sample.adoc file:

== Base Verticle

This document is a reference guide for using the Base verticle as well as the utilities provided by it.

[cols="2,1,4",options="header"]
|===
| Property | Required| Description
|PROPERTY1
|Yes
|random remarks

|PROPERTY2
|No
|random1 remarks

Reply | Threaded
Open this post in threaded view
|

Re: Embedded style not being rendered in java

mojavelinux
Administrator
You need to set the safe mode to "safe". When using the API, the default mode is "secure", which disables many features.


-Dan

On Tue, Aug 1, 2017 at 2:35 AM, jasjeetkaur [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

So I have a .adoc document, that I am rendering as html using java APIs. But the styling is not getting rendered. I have tried using :linkcss: as well as the following.

:stylesdir: mystylesheets/
:stylesheet: mystyles.css

But still there is no styling in my rendered page.

My code is as follows: Attributes attributes = new Attributes();
       
        Options options = new Options();
        options.setAttributes(attributes);
        options.setInPlace(true);

        router.get("/readme.html").handler( ctx -> {
            String html = asciidoctor.convert(
                    getDocFileContent(),
                    options);
            ctx.response().end(html);
        });


I am using a sample readme.adoc file, the content is getting loaded, but the default embedded styling is not rendered. Can somebody please help  me regarding this.

My sample.adoc file:

== Base Verticle

This document is a reference guide for using the Base verticle as well as the utilities provided by it.

[cols="2,1,4",options="header"]
|===
| Property | Required| Description
|PROPERTY1
|Yes
|random remarks

|PROPERTY2
|No
|random1 remarks




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Embedded-style-not-being-rendered-in-java-tp5777.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Embedded style not being rendered in java

jasjeetkaur
I have done that.
options.setSafe(SafeMode.SAFE);

Also, the problem is only with asciidoctor.convert(...) api. If I use the convertFile variant of the api, the style is rendered by default. But I need convert api as I in my logic, passing the file would negate the purpose of my utility.

Thanks
Jasjeet Kaur