Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
I am using coderay to highlight code but one of the changes between 1.4 and 1.5 was to increase the font size (maybe just as a consequence of using different fonts?). I would like to reduce the size of the font, but am at a loss how to do this either at the asciidoc level or through coderay (as I am invoking it via an extension).
Thanks, Dave. |
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
|
The quickest way is to the use a docinfo file {1}. You can put any styles you want in that file. It gets included in the <head> tag of the HTML. The shortcoming of CodeRay at the moment is that it doesn't have alternate themes out of the box (and we don't currently load a custom theme for it). Once we do, then you could just specify an attribute like `coderay-style` and provide your own theme.
-Dan p.s. FYI, why we made the font larger. The larger font size is kinder to your readers. Plus, the font size shrinks as the screen size gets smaller. On Thu, Aug 21, 2014 at 10:07 AM, daveb [via Asciidoctor :: Discussion] <[hidden email]> wrote: I am using coderay to highlight code but one of the changes between 1.4 and 1.5 was to increase the font size (maybe just as a consequence of using different fonts?). I would like to reduce the size of the font, but am at a loss how to do this either at the asciidoc level or through coderay (as I am invoking it via an extension). Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Thanks, Dan.
I was already running a post processor extension to add extra content into the TOC (hyperlinks into the functions defined in the listings), so I just added another postprocessor: Extensions.register {postprocessor ReduceListingFontSizePostprocessor} # Reduce the font size for code listings as this was increased in 1.5 class ReduceListingFontSizePostprocessor < Asciidoctor::Extensions::Postprocessor def process(document, output) output.sub(/code,kbd,pre,samp{font-family:monospace;font-size:1em}/, "code,kbd,pre,samp{font-family:monospace;font-size:0.92em}") end end Maybe not the most elegant or robust way of doing the job, but it works and has the advantage of not having to put docinfo files in the dozens of directories where these documents are held. Dave. |
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
|
On Fri, Aug 22, 2014 at 3:33 AM, daveb [via Asciidoctor :: Discussion] <[hidden email]> wrote: Maybe not the most elegant or robust way of doing the job, but it works and has the advantage of not having to put docinfo files in the dozens of directories where these documents are held. Elegant is when it works for you, not how it works :) I do strongly recommend that you consider using a custom stylesheet if you make further customizations. You can either hack on the original (which is minified) or you can go back and build one using the Asciidoctor stylesheet factory:
Cheers, -Dan Dan Allen | http://google.com/profiles/dan.j.allen |
Free forum by Nabble | Edit this page |