Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
8 posts
|
Is there a way to specify custom admonition icons in the yml file?
Thanks // Patrik |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
48 posts
|
I don't think it can be done in the yml (though I am happy to be proved wrong). Do it in the Asciidoc source instead by setting attributes icons, iconsdir and icontype.
http://asciidoctor.org/docs/user-manual/#attribute-catalog |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
242 posts
|
In reply to this post by IlliteratePhD
If you mean use alternative icons, you can use some of the included ones: https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#key-prefix-admonition-icon
Make sure you check the third footnote, contains a link to the available icons, check the correspondent .yml for the proper names. In my experience, not all work however, if there's some problem, it will appear in the output. Otoh, if what you want is add a custom font with custom icons, I don't think it can't be done without messing with the code. You can try replicating the folder/file structure in prawn, but even if this works, I would not recommend it for maintenance sake. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
8 posts
|
Ok, thanks for the information and the link. I think I understand the options I have then.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
To expand on what Abel said, yes, you can use any icon for admonitions that is supported by prawn-icon (https://github.com/jessedoyle/prawn-icon/). It's possible to add other icon fonts, but it would mean loading some Ruby code that extends prawn-icon. The resolution of the icon is separate from the theme. The theme just passed on this information. Cheers, -Dan On Fri, Aug 18, 2017 at 12:40 AM, IlliteratePhD [via Asciidoctor :: Discussion] <[hidden email]> wrote: Ok, thanks for the information and the link. I think I understand the options I have then. Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
I am trying to figure out the correct theme for the PDF output. I have successfully edited my custom admonition block extension for HTML output, but I am having trouble figuring out exactly how to make the theme.yml file so PDF output can match the custom admonition of the HTML.
I tried to follow the information here: https://github.com/asciidoctor/asciidoctor-extensions-lab/issues/9 but when I try to create a separate template, I am getting error messages. I don't have a problem just editing the default template either, but when I tried to do that by adding this into the admonition section: icon: question: name: fas-question stroke_color: 871452 size: 24 (question is just my filler for now), I get errors in the output stating this: asciidoctor: DEBUG: sample.adoc: line 5: unknown style for example block: QUESTION (line 5 is line with the ==== after the [QUESTION] of the sample file). I have tried adding it to a custom style, but was having trouble figuring out how to call it, and when I thought I did, I got a lot more errors since the only thing in it was the admonition block, so I went back to editing the default (again, this is fine for my purposes), but always get this or some other error message. I am at a loss as to how to edit the default template (or create my own and to call it since that isn't clear either) so I can define the new admonition styles. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
QUESTION is not a valid admonition type. See https://asciidoctor.org/docs/user-manual/#admonition If you want to customize the icon for NOTE, for example, here's a theme file you can use: extends: default admonition: icon: note: name: far-question-circle (It's no longer necessary to modify the default theme file. You can simply extend it). Cheers, -Dan On Tue, Aug 6, 2019 at 12:00 PM be.wood [via Asciidoctor :: Discussion] <[hidden email]> wrote: I am trying to figure out the correct theme for the PDF output. I have successfully edited my custom admonition block extension for HTML output, but I am having trouble figuring out exactly how to make the theme.yml file so PDF output can match the custom admonition of the HTML. ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
Thank you for the quick response. I see how to extend, now, but my problem is that I actually need to create new admonition types. I have defined them without problem for HTML output (actually with REVIEW and GUIDANCE as types), and can generate the HTML without problems. I would like to add these as valid for the PDF output as well, which is where I am stuck, how can I create them as I can using the custom-admonition-block extension?
Thank you |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
Ah, I see what you're saying. You can use the following extension from the extensions lab: https://github.com/asciidoctor/asciidoctor-extensions-lab/blob/master/lib/custom-admonition-block.rb Combine it with this theme: extends: default admonition: icon: question: name: far-question-circle size: 24 Cheers, -Dan On Tue, Aug 6, 2019 at 1:36 PM be.wood [via Asciidoctor :: Discussion] <[hidden email]> wrote: Thank you for the quick response. I see how to extend, now, but my problem is that I actually need to create new admonition types. I have defined them without problem for HTML output (actually with REVIEW and GUIDANCE as types), and can generate the HTML without problems. I would like to add these as valid for the PDF output as well, which is where I am stuck, how can I create them as I can using the custom-admonition-block extension? -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
Thank you. One last question, I ran this command (I renamed the custom-admonition-block to notice-block):
asciidoctor-pdf -a pdf-style:admonition.yml -r notice-block ./notice-block/sample.adoc This ended up giving me this error when I run a trace (and the styles are unknown if I just run verbose): asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:666:in `convert_admonition': undefined method `[]' for nil:NilClass (NoMethodError) The admonition.yml has the styles defined with the extends line first (and nothing else). I don't know if I have the command wrong or if I'm missing something else. Brian |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
Brian, You didn't set the size for your custom admonition icon. Please follow the example I provided: extends: default admonition: icon: question: name: far-question-circle size: 24 (I could make the default size match twice the base font size so this wouldn't be required, but that won't help you until it's released). Best, -Dan On Wed, Aug 7, 2019 at 6:05 AM be.wood [via Asciidoctor :: Discussion] <[hidden email]> wrote: Thank you. One last question, I ran this command (I renamed the custom-admonition-block to notice-block): ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
This is my admonition.yml file (what I called it, anyway):
extends: default admonition: icon: boilerplate: name: fas-lock stroke_color: 3F903E size: 24 icon: review: name: fas-clipboard stroke_color: FDB109 size: 24 icon: guidance: name: fas-book stroke_color: 0909FD size: 24 Brian |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
Sorry to keep asking, but I am still unable to make the PDF output correctly output with the icons. I keep getting the same message and I do have the size specified.
Thank you for the assistance. Brian |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
Brian, Please share a sample project so that I can investigate. You are missing a piece, but without seeing the project, it's hard to guess where that piece is. Best, -Dan On Fri, Aug 9, 2019 at 7:05 AM be.wood [via Asciidoctor :: Discussion] <[hidden email]> wrote: Sorry to keep asking, but I am still unable to make the PDF output correctly output with the icons. I keep getting the same message and I do have the size specified. -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
admonition.yml
extension.rb notice-block.rb sample.adoc These are the three files (with the extension.rb being placed into a notice-block folder in the lib folder). I have tried to call the admonition.yml without success. If I run the straight asciidoctor and call the notice-block to generate HTML output I get what I expect with icons for each of the admonitions in the sample, but when I try to run it for asciidoctor-pdf I don't get anything (they are admonitions, but with no icons), and I get the error messages. This is all on Windows with ruby installed (if that makes any difference). I appreciate all your help (this is for an external community that will rely on what I'm doing here, hopefully to standardize document creation on Asciidoctor and GitHub). Thank you. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
Aha! I see what it is. In your theme, you're redefining the icon category over and over, so only the last one wins. Here's how it should look: extends: default admonition: icon: boilerplate: name: fas-lock stroke_color: 3F903E size: 24 review: name: fas-clipboard stroke_color: FDB109 size: 24 guidance: name: fas-book stroke_color: 0909FD size: 24 Notice how all the icon types are defined under a single parent. This is a limitation imposed by the YAML language itself. If you redeclare a parent in the hierarchy, it replaces all previous declarations. (This does not affect keys that were defined in the theme you extended). Best, -Dan On Fri, Aug 9, 2019 at 1:29 PM be.wood [via Asciidoctor :: Discussion] <[hidden email]> wrote: admonition.yml ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
After making that edit, I try to run this command (which I think is correct for getting all the pieces together (this is from the folder where both the YML and sample files are located):
asciidoctor-pdf -r notice-block -a pdf-style:admonition.yml sample.adoc I get this error though when I try to run this: undefined method `[]' for nil:NilClass Use --trace for backtrace If I run the trace, I get this contents of the attached file. trace.txt Just to be clear, here is the version information from the build I'm using: Asciidoctor PDF 1.5.0.beta.2 using Asciidoctor 2.0.10 [https://asciidoctor.org] Runtime Environment (ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]) (lc:IBM437 fs:Windows-1252 in:IBM437 ex:IBM437) Thank you |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
So I figured out that the problem is using the "-r notice-block" with the asciidoctor-pdf, but if I just use the admonition.yml file I don't get any admonitions.
So the admonition.yml file seems like it needs something else to get it to process, which kind of makes sense, maybe, but if i just call asciidoctor-pdf -a pdf-style:admonition.yml sample.adoc sample.pdf I get this output, which doesn't have any icons. If I run the command asciidoctor -r notice-block sample.adoc sample.html I get the file with all the icons. Thanks |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
Please check your command. You're typing it incorrectly. It should be: asciidoctor-pdf -r ./notice-block.rb -a pdf-theme=./admonition-theme.yml sample.adoc * pdf-style is the deprecated attribute name * themes should be named with the -theme.yml extension * the syntax is pdf-theme=./admonition-theme.yml not pdf-theme:admonition-theme.yml * it's best to reference the extension filename exactly, so -r ./notice-block.rb instead of -r notice-block -Dan On Mon, Aug 12, 2019 at 4:02 PM be.wood [via Asciidoctor :: Discussion] <[hidden email]> wrote: So I figured out that the problem is using the "-r notice-block" with the asciidoctor-pdf, but if I just use the admonition.yml file I don't get any admonitions. ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
14 posts
|
THANK YOU!!!!!
I figured I had to have something wrong, and whatever combination it was, this worked exactly as I expected. I appreciate your help and the great tool you have created. Brian |
Free forum by Nabble | Edit this page |