From: Chunyang Xu <mail@xuchunyang.me>
To: emacs-orgmode@gnu.org
Subject: ox-html: Opt out of htmlize.el
Date: Fri, 10 Nov 2017 00:28:15 +0800 [thread overview]
Message-ID: <m2po8ra02o.fsf@xuchunyang.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 370 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Allow-disabling-htmlize.patch --]
[-- Type: text/x-patch, Size: 1650 bytes --]
From 902e6cea48912bd291c1d3192cb30dc9a1a41fa3 Mon Sep 17 00:00:00 2001
From: Chunyang Xu <mail@xuchunyang.me>
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
next reply other threads:[~2017-11-09 16:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 16:28 Chunyang Xu [this message]
2017-11-12 22:30 ` ox-html: Opt out of htmlize.el Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2po8ra02o.fsf@xuchunyang.me \
--to=mail@xuchunyang.me \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).