Is it possible to embed and consume css-classes within adoc file?

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

Is it possible to embed and consume css-classes within adoc file?

Taz
Is it possible to embed and consume custom styles/classes in asciidoc file? for instance, instead of doing something like this:

pass:[<span style="background:#C3E4F5;">blueish-bg-color</span>]

Or:

+++<span style="background:#C3E4F5;">blueish-bg-color</span>+++

Can I place a style somewhere within the adoc file:

<style>
   blueish-bg : { background-color : #C3E4F5; }
</style>

and then apply it:
[blueish-bg]#blueish-bg-color#
 ?

Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to embed and consume css-classes within adoc file?

abelsromero
If you only need to add some custom styles you can include it with a `docinfo` file http://asciidoctor.org/docs/user-manual/#naming-docinfo-files and then use roles as you propose at the end of your post.

I have two notes to add:
1. For the sake cohesion, I'd define a docinfo.html that only includes a custom css and then a CSS file, but you can do it inline in the same docinfo if you want.
2. Roles should add semantic and meaning to the text. They map to a CSS class and so you will use it to define styles. But I recommend to first defined them around concepts, like "important", "to_review" or "inline_example" instead of "bold", "blue_backgorund_with_yellow_bold_text". Once you define those, think how to display those roles and write the CSS.
Taz
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to embed and consume css-classes within adoc file?

Taz
Great, exactly what I needed, thanks!!