* [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)]
@ 2024-06-14 16:22 Mehul Sanghvi
2024-06-15 13:32 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Mehul Sanghvi @ 2024-06-14 16:22 UTC (permalink / raw)
To: ML Emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 14027 bytes --]
Summary:
========
I would like to be able to set =:html-htmlize-output-type= on a
per-project basis. That does not seem to be working. If I have
~htmlize.el~ installed and set =:html-htmlize-output-type css=, then I
get hardcoded values for the colours being used in the code blocks. If
I don't have ~htmlize.el~ installed, I get plain text. To get CSS class
names, I have to do an explicit =(setq org-html-htmlize-output-type
'css)= which effects all publishing projects.
1. What exactly did you do?
I set =:html-htmlize-output-type css= in the _blog-non-prod_ project.
I also set =:html-htmlize-output-type 'css= and then tried both values
with =htmlize-output-type= as well.
2. What did you expect to happen?
I was expecting that the generated HTML would have code blocks with
class names in the CSS so that I could apply the CSS I wanted. A sample
of what I was expecting:
<div class="org-src-container">
<pre class="src src-C"><span class="org-preprocessor">#include</span> <span
class="org-string"><stdio.h></span>
<span class="org-preprocessor">#include</span> <span
class="org-string"><iso646.h></span>
<span class="org-type">int</span> <span
class="org-function-name">main</span>()
{
<span class="org-type">int</span> <span
class="org-variable-name">i</span> = 0;
<span class="org-type">int</span> <span
class="org-variable-name">limit</span> = 1000 ;
<span class="org-type">int</span> <span
class="org-variable-name">total_sum</span> = 0 ;
printf(<span class="org-string">"Project Euler in C: \n"</span>);
<span class="org-keyword">while</span> ( i < limit )
{
<span class="org-keyword">if</span> ( ((i % 3) == 0) || ((i % 5) ==
0) )
{
total_sum += i;
}
i++ ;
}
printf(<span class="org-string">"\tAnswer 1: %d \n"</span>, total_sum);
<span class="org-keyword">return</span> (0) ;
}
</pre>
</div>
3. What happened instead?
Instead all the styles had the colour hardcoded in the code blocks if
~htmlize~ package was installed. Otherwise everything was generated as
plain text and put inside =<pre>...</pre>= tags and have no style to
them.
e.g.:
hardcoded style:
================
<div class="org-src-container">
<pre class="src src-C"><span style="color: #ffd700;">#include</span> <span
style="color: #deb887;"><stdio.h></span>
<span style="color: #ffd700;">#include</span> <span style="color:
#deb887;"><iso646.h></span>
<span style="color: #98f5ff;">int</span> <span style="color:
#daa520;">main</span>()
{
<span style="color: #98f5ff;">int</span> <span style="color:
#4eee94;">i</span> = 0;
<span style="color: #98f5ff;">int</span> <span style="color:
#4eee94;">limit</span> = 1000 ;
<span style="color: #98f5ff;">int</span> <span style="color:
#4eee94;">total_sum</span> = 0 ;
printf(<span style="color: #deb887;">"Project Euler in C: \n"</span>);
<span style="color: #00bfff;">while</span> ( i < limit )
{
<span style="color: #00bfff;">if</span> ( ((i % 3) == 0) || ((i % 5)
== 0) )
{
total_sum += i;
}
i++ ;
}
printf(<span style="color: #deb887;">"\tAnswer 1: %d \n"</span>,
total_sum);
<span style="color: #00bfff;">return</span> (0) ;
}
</pre>
</div>
plain text:
===========
<div class="org-src-container">
<pre class="src src-C">#include <stdio.h>
#include <iso646.h>
int main()
{
int i = 0;
int limit = 1000 ;
int total_sum = 0 ;
printf("Project Euler in C: \n");
while ( i < limit )
{
if ( ((i % 3) == 0) || ((i % 5) == 0) )
{
total_sum += i;
}
i++ ;
}
printf("\tAnswer 1: %d \n", total_sum);
return (0) ;
}
</pre>
</div>
emacs startup:
==============
tcsh% emacs --init-directory ~/.emacs.d/emacs-init-testing
versions:
=========
Emacs : GNU Emacs 29.3 (build 1, amd64-portbld-freebsd13.2)
Package: Org mode version 9.6.15 (release_9.6.15 @
/usr/local/share/emacs/29.3/lisp/org/)
current state:
==============
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
org-publish-project-alist '(("blog-non-prod" :base-directory
"~/org/personal-web-site/" :base-extension "org" :publishing-directory
"~/www/np/" :publishing-function
org-html-publish-to-html :recursive t :exclude "level-.*\\|.*.draft.org
\\|.*~"
:section-numbers nil :with-toc nil
:with-sub-superscript nil :with-author nil :with-date t :with-drawers t
:auto-sitemap nil :html-use-infojs nil
:htmlize-output-type css)
("assets" :base-directory "~/org/assets/"
:base-extension
"css\\|js\\|png\\|jpg\\|jpeg\\|svg\\|gif\\|pdf\\|mp3\\|mp4\\|ogg\\|webm\\|webp"
:publishing-directory "~/www/"
:recursive t :publishing-function
org-publish-attachment)
("personal-non-prod" :components
("blog-non-prod" "assets")))
org-persist-after-read-hook '(org-element--cache-persist-after-read)
org-export-before-parsing-hook '(org-attach-expand-links)
org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-archive-hook '(org-attach-archive-delete-maybe)
org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change
org-cycle-display-inline-images)
org-persist-before-read-hook '(org-element--cache-persist-before-read)
org-mode-hook '(#[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2]
#[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-fold-show-all append local] 5]
#[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-babel-load-languages '((awk . t) (C . t) (calc . t) (css . t) (dot .
t) (emacs-lisp . t) (forth . t) (fortran . t) (gnuplot . t)
(groovy . t) (haskell . t) (java . t) (js . t)
(latex . t) (lisp . t) (makefile . t) (ocaml . t) (octave . t)
(org . t) (perl . t) (python . t) (R . t) (ruby
. t) (scheme . t) (sed . t) (shell . t) (sql . t) (sqlite . t)
(table . t))
org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
org-latex-format-headline-function
'org-latex-format-headline-default-function
org-confirm-shell-link-function 'yes-or-no-p
org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-odt-format-headline-function 'org-odt-format-headline-default-function
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-tangle-lang-exts '(("sed" . "sed") ("ruby" . "rb") ("python" .
"py") ("perl" . "pl") ("ocaml" . "ml") ("lisp" . "lisp")
("latex" . "tex") ("java" . "java")
("haskell" . "hs") ("groovy" . "groovy") ("fortran" . "F90") ("D" . "d")
("C++" . "cpp") ("awk" . "awk") ("emacs-lisp"
. "el") ("elisp" . "el"))
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-html-htmlize-output-type 'css
org-confirm-elisp-link-function 'yes-or-no-p
org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-fold-core-isearch-open-function 'org-fold--isearch-reveal
org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
org-persist-before-write-hook '(org-element--cache-persist-before-write)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-link-shell-confirm-function 'yes-or-no-p
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link) ("id" :follow org-id-open)
("eww" :follow org-eww-open :store
org-eww-store-link) ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
("mhe" :follow org-mhe-open :store
org-mhe-store-link)
("irc" :follow org-irc-visit :store
org-irc-store-link :export org-irc-export)
("info" :follow org-info-open :export
org-info-export :store org-info-store-link :insert-description
org-info-description-as-command)
("gnus" :follow org-gnus-open :store
org-gnus-store-link)
("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export
org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link)
("w3m" :store org-w3m-store-link) ("doi" :follow
org-link-doi-open :export org-link-doi-export) ("file+sys")
("file+emacs") ("shell" :follow org-link--open-shell)
("news" :follow #[514 "\301\300\302 Q \"\207"
["news" browse-url ":"] 6 "\n\n(fn URL ARG)"])
("mailto" :follow #[514 "\301\300\302 Q \"\207"
["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"])
("https" :follow #[514 "\301\300\302 Q \"\207"
["https" browse-url ":"] 6 "\n\n(fn URL ARG)"])
("http" :follow #[514 "\301\300\302 Q \"\207"
["http" browse-url ":"] 6 "\n\n(fn URL ARG)"])
("ftp" :follow #[514 "\301\300\302 Q \"\207" ["ftp"
browse-url ":"] 6 "\n\n(fn URL ARG)"])
("help" :follow org-link--open-help :store
org-link--store-help) ("file" :complete org-link-complete-file)
("elisp" :follow org-link--open-elisp))
org-html-format-headline-function
'org-html-format-headline-default-function
org-metaup-hook '(org-babel-load-in-session-maybe)
)
~/.emacs.d/emacs-init-testing/init.el:
======================================
;; to show which init.el is being used
(defvar ksi/emacs-init-testing t)
;; indentation will insert tabs if non-nil.
;; so if you want spaces, keep this nil, as you should have done
;; by default anyway. TABS ARE EVIL !!
(setq-default indent-tabs-mode nil)
;; most programming modes that are derived from CC-Mode use this
;; to control the indentation setting. C/C++/ObjC/Java
(setq c-default-style '((java-mode . "java")
(awk-mode . "awk")
(c-mode . "k&r")
(c++-mode . "stroustrup")
(other . "gnu")))
(setq c-tab-always-indent t)
;; if you want the braces to NOT be on the same line, you want to
;; set the below to non-nil
(setq c-auto-newline nil)
;; groovy indentation
;; default: 4
(setq groovy-indent-offset 4)
;;;; GnuTLS settings as they might affect package.el
;;;
;;; priority strings can be set according to
;;; https://www.gnutls.org/manual/html_node/Priority-Strings.html
(setq gnutls-algorithm-priority nil) ;; this is the default
;;; temporary solution to work around a bug with GnuTLS handling TLS1.3
;;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
(setq gnutls-algorithm-priority
"NONE:+SECURE256:!VERS-ALL:+VERS-TLS1.2:!VERS-TLS1.3")
;;;;
;;;; packages
;;;;
;; All package setup occurrs between the (require 'package) and
;; the (package-initialize)
;;
(require 'package)
(setq package-archives nil)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
(package-initialize)
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; since we're going to set some variables for use-package
;; we have to require use-package
(require 'use-package)
(setq use-package-verbose t
use-package-always-ensure t)
;; htmlize
(use-package htmlize
:ensure t
:init
(setq htmlize-output-type 'css)
)
;; smartparens -- this combines autopair and a bunch of others into one
package.
(use-package smartparens
:ensure t
:hook (prog-mode . smartparens-mode)
:config
(require 'smartparens-config)
(smartparens-global-mode t)
(show-smartparens-global-mode t))
(use-package which-key
:ensure t
:init
(which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 0.3))
(load (concat user-emacs-directory "org-publishing-tutorial.el") t)
(setq custom-file (concat user-emacs-directory "ksi-custom-file.el"))
(load custom-file t)
(add-to-list 'term-file-aliases
'("dumb" . "xterm-256color"))
(load-theme 'deeper-blue)
;;; init.el ends here
~/.emacs.d/emacs-init-testing/ksi-custom-file.el:
=================================================
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(which-key smartparens)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
--
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com
[-- Attachment #2: Type: text/html, Size: 18600 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)]
2024-06-14 16:22 [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)] Mehul Sanghvi
@ 2024-06-15 13:32 ` Ihor Radchenko
2024-06-17 17:44 ` Mehul Sanghvi
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-06-15 13:32 UTC (permalink / raw)
To: Mehul Sanghvi; +Cc: ML Emacs-orgmode
Mehul Sanghvi <mehul.sanghvi@gmail.com> writes:
> I would like to be able to set =:html-htmlize-output-type= on a
> per-project basis. That does not seem to be working. If I have
> ~htmlize.el~ installed and set =:html-htmlize-output-type css=, then I
> get hardcoded values for the colours being used in the code blocks. If
> I don't have ~htmlize.el~ installed, I get plain text. To get CSS class
> names, I have to do an explicit =(setq org-html-htmlize-output-type
> 'css)= which effects all publishing projects.
>
>
> 1. What exactly did you do?
>
> I set =:html-htmlize-output-type css= in the _blog-non-prod_ project.
> I also set =:html-htmlize-output-type 'css= and then tried both values
> with =htmlize-output-type= as well.
ox-html does not currently support setting :html-htmlize-output-type
option. Only variable `org-html-htmlize-output-type' is supported.
Same for `org-html-htmlize-font-prefix'.
It would be nice to change this, yes.
Confirmed.
Patches welcome!
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)]
2024-06-15 13:32 ` Ihor Radchenko
@ 2024-06-17 17:44 ` Mehul Sanghvi
2024-06-17 17:49 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Mehul Sanghvi @ 2024-06-17 17:44 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: ML Emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
On Sat, Jun 15, 2024 at 9:30 AM Ihor Radchenko <yantar92@posteo.net> wrote:
> Mehul Sanghvi <mehul.sanghvi@gmail.com> writes:
>
> > I would like to be able to set =:html-htmlize-output-type= on a
> > per-project basis. That does not seem to be working. If I have
> > ~htmlize.el~ installed and set =:html-htmlize-output-type css=, then I
> > get hardcoded values for the colours being used in the code blocks. If
> > I don't have ~htmlize.el~ installed, I get plain text. To get CSS class
> > names, I have to do an explicit =(setq org-html-htmlize-output-type
> > 'css)= which effects all publishing projects.
> >
> >
> > 1. What exactly did you do?
> >
> > I set =:html-htmlize-output-type css= in the _blog-non-prod_ project.
> > I also set =:html-htmlize-output-type 'css= and then tried both values
> > with =htmlize-output-type= as well.
>
> ox-html does not currently support setting :html-htmlize-output-type
> option. Only variable `org-html-htmlize-output-type' is supported.
> Same for `org-html-htmlize-font-prefix'.
>
> It would be nice to change this, yes.
> Confirmed.
>
> Patches welcome!
>
>
Ihor, thanks for clarifying that information. I've made adjustments in my
configs based on that information.
For patches, I'll see what I can do, but my emacs-lisp is not very great.
Also wouldn't I need to sign some
documents with FSF in order to contribute?
cheers,
mehul
--
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com
[-- Attachment #2: Type: text/html, Size: 2302 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-17 17:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 16:22 [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)] Mehul Sanghvi
2024-06-15 13:32 ` Ihor Radchenko
2024-06-17 17:44 ` Mehul Sanghvi
2024-06-17 17:49 ` Ihor Radchenko
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).