Open bricewge opened 8 years ago
This is caused by the insertion of inline-css code by htmlize
, which then parsed by pygments
produce some garbage.
The current workaround that I have found is to set org-html-htmlize-output-type
to nil
however this isn't the right way as htmlize
isn't used anymore and we loose the fontification but not the colorization of the text.
Does the org-file export correctly to html using org-export? Can you share a sample post with this problem?
I am getting this too.
Emacs 25.1.1 Org 8.2.10 Nikola v7.8.3
Example org file:
#+BEGIN_COMMENT
.. title: Another Test Post using OrgMode Plugin
.. slug: another-test-post-using-orgmode-plugin
.. date: 2017-02-22 21:30:50 UTC+01:00
.. tags:
.. category:
.. link:
.. description:
.. type: text
#+END_COMMENT
#+BEGIN_SRC python :results output :exports both
print("Hello World")
#+END_SRC
yields this in the browser
<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Hello World"</span>)
rather than
print("Hello World")
I am using a virtual environment for code execution. The contents of conf.el in the nikola orgmode plugin directory:
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/")
t)
(package-initialize))
(require `ob-ipython)
(require `pyvenv)
(require `htmlize)
;; pyvenv setup
;; this is required for many code blocks to execute
;; Specifically, R and python
(setenv "WORKON_HOME" "~/anaconda/envs")
(setq pyvenv-workon "python3")
(setenv "WORKON" "python3")
(pyvenv-mode 1)
;; sets up stata execution
(require 'ess-site)
;; turns off prompts
(setq ess-ask-for-ess-directory nil)
;; elisp lib dir
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; load ob-stata
(load "ob-stata")
;; sets up org-babel for code cell execution
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)
(ipython . t)
(R . t)
(sh . t)
(matlab . t)
(stata . t)
))
;; execute without prompts
(setq org-confirm-babel-evaluate nil)
Every language I tried known by pygmentize has problems.
Also, I can confirm that the html produced by exporting to html directly from org works fine and highliting is perfect.
Setting org-html-htmlize-output-type
to nil
in conf.el
as suggest by @bricewge causes the build to fail:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "... /doit/action.py", line 403, in execute
returned_value = self.py_callable(*self.args, **kwargs)
File "... /nikola/post.py", line 540, in compile
lang)
File "... nikola/plugin_categories.py", line 304, in compile
self.compile_html(source, dest, is_two_file)
File "... blog/plugins/orgmode/orgmode.py", line 97, in compile_html
source, e.returncode))
Exception: Cannot compile posts/test-post-using-orgmode-plugin.org -- bad org-mode configuration (return code 255)
@roblem Thank you for filing your report, with your config and an example post. But, it looks like the config you posted is incomplete. Please share the full init.el
file and the full build output (on success and failure).
See the files here https://gist.github.com/roblem/76fafbd5194b649d71d7e22b0153a8af
I will try reproducing the issue with your config, Thanks.
But to begin with can you try fixing these requires? The backtick needs to be a single-quote.
(require `ob-ipython)
(require `pyvenv)
(require `htmlize)
(require 'ob-ipython)
(require 'pyvenv)
(require 'htmlize)
Fixed those 3 things and have the same result.
Fixed it:
Using a fresh install of Fedora in a VM with an Anaconda virtual environment, things work flawlessly even though the following appears when building a simple test site:
Cannot fontify src block (htmlize.el >= 1.34 required)
Despite this message, nikola rendered the site perfectly. If you don't see this "error" message then your site will build but with the problems described above. Be sure you haven't installed htmlize.el manually, via melpa, or via your distribution's package manager (and being loaded in a system emacs init). If your site fails to build, it IS NOT because you haven't installed htmlize.el, you have an error somewhere in conf.el or in your org file.
So, the issue described in #171, is correct: the error above is a bogus error that you want to see when building your site. Perhaps this should be added to the plugin description page.
The present orgmode plugin complain about
htmlize.el
no being present:Adding something like this to init.el should do the job:
Now there is no complain about
htmlize.el
but unfortunatly the HTML produce is broken; here is an example: