0

Using EmacsMac 28.1 (OSX) (started as emacs -q), I'm trying to export a simple org document that contains an org source block:

#+begin_src org
*Hello* /world/
#+end_src

When I export this to a buffer (C-c C-e h H), the block is exported as:

...
<div class="org-src-container">
<pre class="src src-org">*Hello* /world/
</pre></div>
...

I would like to have the Hello in bold and the world in italic but I cannot identify which option to set. The answer is probably pretty obvious but I'm stuck.

2
  • It was more or less obvious (require 'htmlize) + (setq org-html-htmlize-output-type 'css) (htmlize is at github.com/hniksic/emacs-htmlize) Jul 5, 2022 at 20:04
  • Please make your comment into an answer (and expand it a bit to explain what org-html-htmlize-output-type does). You can then accept your own answer. This way, future visitors will be able to see that the question has an accepted answer when searching to solve this or a similar problem.
    – NickD
    Jul 5, 2022 at 20:51

1 Answer 1

0

You need to install htmlize and optionally set the output type to 'css or 'inline-css then:

(require 'htmlize)
(setq org-html-htmlize-output-type 'css)
1
  • 1
    Can you edit your answer and add an explanation of what the variable does? What does it mean to give it the value css? What other values does it take? What was the (presumably default) value before you changed it? What led you to this variable? I'm asking because I don't know the answers and it is certainly not obvious to me why/how the solution works. I promise to upvote :-)
    – NickD
    Jul 6, 2022 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.