Custom css via the API?
Posted by
arillbert on
Mar 17, 2021; 8:21pm
URL: https://discuss.asciidoctor.org/Custom-css-via-the-API-tp8568.html
Hi,
I am trying to convert an adoc string to a stand-alone file via the ruby API. It works as expected as long as I use the default stylesheet but I would like to use a custom css and I have failed miserably with this.
Working code for generating an html file with the default style sheet is:
...
Asciidoctor.convert(my_adoc_src_string,
to_file: "myfile.html,
safe: :unsafe,
)
...
One version of the invocations I've unsuccessfully tried is:
...
Asciidoctor.convert(my_adoc_src_string,
to_file: "myfile.html,
safe: :unsafe,
attributes: {
stylesheet: "path/to/my/stylesheet.css",
}
)
...
The html is still generated using the default style sheet. What am I missing?
My goal is to have my custom css embedded in the output to make it more portable.
Regards
/Anders