Org-mode has an awesome feature to colorize text in source code blocks. However, it uses the current colors of the emacs theme. I often use the dark zenburn theme, which will place some parts of Java in light colors. When I publish to HTML, the light colors are not readable. The workaround is to restart emacs and re-publish without loading a them.
Any better way?
Org Mode (also: org-mode; /ˈɔːrɡ moʊd/) is a document editing, formatting, and organizing mode, designed for notes, planning, and authoring within the free software text editor Emacs.
To save the document, either press the save icon, or press C-x C-s, call it 1.org.
To load Org-reveal, type “M-x load-library”, then type “ox-reveal”. Now you can export this manual into Reveal. js presentation by typing “C-c C-e R R”. Open the generated “Readme.
By default org-mode exports source code with inline style information based on your current theme. However by setting org-html-htmlize-output-type
to 'css
rather than the default 'inline-css
the generated html will have classes corresponding to the faces used. You can then provide your own css to style the faces.
For example exporting a snippet with org-html-htmlize-output-type
set to 'inline-css
gives the following:
<pre class="src src-sh">
<span style="color: #F0DFAF; font-weight: bold;">for</span> f<span style="color: #F0DFAF; font-weight: bold;"> in</span> *; <span style="color: #F0DFAF; font-weight: bold;">do</span>
<span style="color: #93E0E3;">echo</span> $<span style="color: #DFAF8F;">f</span>
<span style="color: #F0DFAF; font-weight: bold;">done</span>
</pre>
While exporting the same snippet with org-html-htmlize-output-type
set to 'css
gives:
<pre class="src src-sh">
<span class="org-keyword">for</span> f<span class="org-keyword"> in</span> *; <span class="org-keyword">do</span>
<span class="org-builtin">echo</span> $<span class="org-variable-name">f</span>
<span class="org-keyword">done</span>
</pre>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With