From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chunyang Xu Subject: ox-html: Opt out of htmlize.el Date: Fri, 10 Nov 2017 00:28:15 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCpgp-0001Q6-3y for emacs-orgmode@gnu.org; Thu, 09 Nov 2017 11:28:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCpgl-0007Cv-Ra for emacs-orgmode@gnu.org; Thu, 09 Nov 2017 11:28:27 -0500 Received: from forward106o.mail.yandex.net ([37.140.190.187]:46479) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCpgl-0007Bc-Hk for emacs-orgmode@gnu.org; Thu, 09 Nov 2017 11:28:23 -0500 Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 535AF789C3A for ; Thu, 9 Nov 2017 19:28:21 +0300 (MSK) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-html-Allow-disabling-htmlize.patch >From 902e6cea48912bd291c1d3192cb30dc9a1a41fa3 Mon Sep 17 00:00:00 2001 From: Chunyang Xu 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 --=-=-=--