Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying custom style to paragraph using a role #483

Closed
zgrzybek opened this issue Jul 29, 2016 · 5 comments
Closed

Applying custom style to paragraph using a role #483

zgrzybek opened this issue Jul 29, 2016 · 5 comments
Assignees
Milestone

Comments

@zgrzybek
Copy link

zgrzybek commented Jul 29, 2016

I'm searching for a way to apply my custom style to a paragraph, I couldn't see anything in the https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc

I would like to define my style, eg.
mystyle:
font_size: 24

and apply it to my paragraph:, eg.
[.mystyle]
paragraph content

Is there a way to achive that in asciidoctor-pdf?

@mojavelinux
Copy link
Member

This is not really possible as of yet. My vision is to allow a role to be specified and then allow that role to be assigned properties in the theme. The theme part you cited is correct. However, you'd use a role not a block style in the AsciiDoc:

[.myStyle]
paragraph content

@zgrzybek
Copy link
Author

That sounds good.

So my understanding is that currently it is not possible to create my own style and apply it to some element. I could apply something only using extensions, right?

@mojavelinux
Copy link
Member

my understanding is that currently it is not possible to create my own style and apply it to some element

That is correct.

You'd need to extend the converter as described in the following blog post:

http://raibledesigns.com/rd/entry/re_customizing_an_asciidoctor_pdf

the updated source of which is available in the following repository:

https://github.com/mraible/infoq-mini-book/blob/master/src/main/ruby/asciidoctor-pdf-extensions.rb

Do keep in mind, though, that it may be necessary to refactor the custom code once we address #53.

@mojavelinux
Copy link
Member

We've now defined a place for roles in the theme (see https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#keys-role). The next step would be to make use of them for blocks, like paragraphs.

@mojavelinux
Copy link
Member

I have figured out a way to support roles on paragraphs. Let's start there to make this capability available, then expand that support to other blocks in separate issues.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 15, 2022
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 15, 2022
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants