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:
#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) ;
}
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 =
...
= tags and have no style to them. e.g.: hardcoded style: ================
#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) ;
}
plain text: ===========
#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) ;
}
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