emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] ox-html: Opt out of htmlize.el


From: Chunyang Xu
Subject: [O] ox-html: Opt out of htmlize.el
Date: Fri, 10 Nov 2017 00:28:15 +0800
User-agent: mu4e 0.9.18; emacs 27.0.50

Hi,

I think htmlize.el should be optional for ox-html. Although htmlize.el
is cool, there are still reasons to don't use it, e.g.,

- Colors looks nice in Emacs looks bad in the web browser
- No color at all in batch mode
- I want to use third party solutions such pygmentize and highlight.js

When user sets org-html-htmlize-output-type to nil, don't use
htmlize.el.

>From 902e6cea48912bd291c1d3192cb30dc9a1a41fa3 Mon Sep 17 00:00:00 2001
From: Chunyang Xu <address@hidden>
Date: Thu, 9 Nov 2017 23:43:32 +0800
Subject: [PATCH] ox-html: Allow disabling htmlize

* lisp/ox-html.el (org-html-fontify-code): Do it.

Disable htmlize by setting org-html-htmlize-output-type to nil.

TINYCHANGE
---
 lisp/ox-html.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 1c3dd8090..d0fe33f2a 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2158,7 +2158,11 @@ is the language used for CODE, as a string, or nil."
      ((not lang)
       ;; Simple transcoding.
       (org-html-encode-plain-text code))
-     ;; Case 2: No htmlize or an inferior version of htmlize
+     ;; Case 2: plain text explicitly set
+     ((not org-html-htmlize-output-type)
+      ;; Simple transcoding.
+      (org-html-encode-plain-text code))
+     ;; Case 3: No htmlize or an inferior version of htmlize
      ((not (and (or (require 'htmlize nil t)
                    (error "Please install htmlize from 
https://github.com/hniksic/emacs-htmlize";))
                (fboundp 'htmlize-region-for-paste)))
@@ -2166,10 +2170,6 @@ is the language used for CODE, as a string, or nil."
       (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
       ;; Simple transcoding.
       (org-html-encode-plain-text code))
-     ;; Case 3: plain text explicitly set
-     ((not org-html-htmlize-output-type)
-      ;; Simple transcoding.
-      (org-html-encode-plain-text code))
      (t
       ;; Map language
       (setq lang (or (assoc-default lang org-src-lang-modes) lang))
-- 
2.14.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]