Skip to content
New issue

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

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

Already on GitHub? # to your account

Icon admonitions proof-of-concept. #15 #90

Closed
wants to merge 12 commits into from
Closed

Icon admonitions proof-of-concept. #15 #90

wants to merge 12 commits into from

Conversation

jessedoyle
Copy link
Contributor

I took a stab at adding Font Awesome icons to admonitions. I would consider this code as a proof-of-concept, as I don't have enough familiarity with the AsciiDoc spec to test all the edge cases.

This code also relies on an external dependency prawn/icon to handle icon rendering.

Here's the sample .adoc code I used to test:

= Asciidoctor PDF: Icon-Based Admonitions
Jesse Doyle <https://github.com/jessedoyle[@jessedoyle]>
// Settings:
:compat-mode!:
:experimental:
:idprefix:
:idseparator: -
:icons: font

.Multi-line
CAUTION: Lorem Ipsum
dolor sit amet, consectetur adipiscing elit. Nullam nulla magna, egestas ut porttitor a, facilisis ac risus.
Curabitur faucibus pharetra libero et malesuada. Integer sed congue enim. Aliquam condimentum iaculis risus, id aliquam velit
blandit sed. Donec venenatis eu velit vel congue. Sed dignissim, nunc nec consequat euismod, nibh risus vehicula sapien,
in condimentum nisi sapien vitae turpis. Donec at orci in tellus pharetra malesuada. Suspendisse potenti.

TIP: A single line.
Test tip.

NOTE: A single line.
Test note.

IMPORTANT: A single line.
Test important.

WARNING: A single line.
Test warning.

Here's the results using the current asciidoctor-pdf:

admonitions

Here's the results after rendering admonitions as icons:

admonitions_icons

@rmpestano
Copy link

when i try to bundle your version i get:

Bundler could not find compatible versions for gem "prawn":
In Gemfile:
asciidoctor-pdf (>= 0) ruby depends on
prawn-icon (= 0.6.1) ruby depends on
prawn (< 3.0.0, >= 1.3.0) ruby

asciidoctor-pdf (>= 0) ruby depends on
  prawn (1.2.1)

solved by updating praw to 1.3.0 in gemspec

congrats for the work!

@jessedoyle
Copy link
Contributor Author

@rmpestano - Good catch! As the developer behind prawn/icon, I can assure you that it is actually compatible with prawn 1.2.1. Perhaps I should relax its gem version dependencies in the future.

@mojavelinux - Is there a particular reason that the latest asciidoctor-pdf uses prawn 1.2.1 instead of 1.3.0?

@madmas
Copy link

madmas commented Mar 26, 2015

Hi, I gave it a try on my machine and it worked like a charm.
What needs to be done here to support it's way into master? ;-)

@LuaxY
Copy link

LuaxY commented Mar 31, 2015

Work like a charm, thanks !

@jessedoyle
Copy link
Contributor Author

@mojavelinux: I fixed any merge conflicts on my local fork. Is there anything I should do to get this patch merged into master? It seems to be the consensus that this patch solves the issue for most users. It is also a great starting point to implement the full assortment of FontAwesome icons.

@mojavelinux
Copy link
Member

@jessedoyle You've done all the right steps on your side. I'm back to hacking on Asciidoctor PDF, so reviewing and merging this patch is on my list for this week. Stay tuned.

@mojavelinux
Copy link
Member

Merged as 7463621.

@jessedoyle This is just fantastic! prawn-icon truly makes this code very elegant and it looks amazing! It also opens the door to support inline icons.

I made some small changes to the code style and slight adjustments to the layout. Most importantly, I found a way to allow the icons to be full size even with a single line of text (by putting a touch of padding around the admonition content). It looks superb!

@mojavelinux
Copy link
Member

Thanks @jessedoyle!!

@VickyatPWs
Copy link

Great, thanks guys :-) now I get the icons in the pdf as well. Sorry for being a pain however... is there a way selecting the icon out of my custom icons? Thank you so much for your feedback and time :-)

@mojavelinux
Copy link
Member

@VickyatPWs There is no way to customize the icons yet, but that is planned. Please refer to #121 and post any additional requirements you might have.

@VickyatPWs
Copy link

ok, thanks for your reply. Now that I know, I can stop trying to find a way to do so through arguments.

@mojavelinux
Copy link
Member

:)

What we are looking for is input about how the configuration might look. If you have a preference, don't hesitate to mention it. I'll start by suggesting an idea in #121.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants