0

Asciidoctor will process the file simple.adoc containing:

:source-highlighter: pygments

[source,java]
Foo bar = baz + qux;

using pygments to produce many syntax categories

syntax-highlighted code

We can confirm that the HTML produced is indeed quite rich:

<div class="content">
<pre class="pygments highlight">
<code data-lang="java"><span class="tok-n">Foo</span> 
<span class="tok-n">bar</span> <span class="tok-o">=</span> 
<span class="tok-n">baz</span> <span class="tok-o">+</span> 
<span class="tok-n">qux</span><span class="tok-o">;</span>
</code></pre>
</div>

But the default stylesheet poorly distinguishes between the syntax categories.

How can I customize the output, perhaps by inserting a new CSS stylesheet or by modifying the values in the existing stylesheet?

Update (Thanks LightGuard) If we save the file simple-docinfo.html, whose name matches the file we're processing but has the suffix -docinfo and the extension .html, containing the one line:

<link rel="stylesheet" href="basejump.css">

and then run asciidoctor simple.adoc, we should see basejump.css appear in simple.html. But no such basejump.css appears. Why?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Calaf
  • 10,113
  • 15
  • 57
  • 120

1 Answers1

0

You could make changes in another stylesheet and load it with a docinfo file.

UPDATE 2015-02-25: You need to include the :docinfo: attribute either in the file header, or an the commandline with -a docinfo

LightGuard
  • 5,298
  • 19
  • 19
  • Thanks.. I see (http://asciidoctor.org/docs/user-manual/#docinfo-attributes-and-file-names) that if I write a file simple-docinfo.html containing '' and then process simple.html using "asciidoctor simple.html" (no command-line options needed), "basejump.css" should appear in the resulting simple.html, but no such "basejump.css" makes it through. Continuing to look... – Calaf Feb 24 '15 at 15:18
  • Is your adoc file called simple? The first part of -dockinfo needs to be the same as the source filename, then it should pick up the docinfo and add it to the resulting html. – LightGuard Feb 24 '15 at 18:38
  • The question is now updated to put in context the question in the comment. – Calaf Feb 25 '15 at 15:35
  • Updated the answer to include the use of the attribute to trigger the docinfo inclusion – LightGuard Feb 25 '15 at 20:08