From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gAsEIBvl1WLcVAEAbAwnHQ (envelope-from ) for ; Tue, 19 Jul 2022 00:56:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cMYIIBvl1WJODAEA9RJhRA (envelope-from ) for ; Tue, 19 Jul 2022 00:56:27 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 014EE3FBE for ; Tue, 19 Jul 2022 00:56:27 +0200 (CEST) Received: from localhost ([::1]:59710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDZf7-0004qO-UF for larch@yhetil.org; Mon, 18 Jul 2022 18:56:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDZeK-0004pt-Ty for emacs-orgmode@gnu.org; Mon, 18 Jul 2022 18:55:36 -0400 Received: from mail-0301.mail-europe.com ([188.165.51.139]:40908) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDZeI-0004Wx-Bx for emacs-orgmode@gnu.org; Mon, 18 Jul 2022 18:55:36 -0400 Date: Mon, 18 Jul 2022 22:55:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1658184920; x=1658444120; bh=sMovO5YHDbiFeb8QVSmm9DAccv3RzT57DT7KzI/oWfY=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=saHopKqGXWYwad5B4Ho+xgPwQOsDh5jVrmhOkWOs5qpKqFQO59I/pr3KCNmj/c/H1 hAsIACSuxxZMi57hi/BYcxBSgnPtllnx3KqXtUazsykPhMH826zfhn8xGVI0wE/pOs q1mQjMYB4JC/eNf/7xxF12ptLQfZ8S/o1Q4S9O/tYPJUmJZlEg+raFHdPBLA0iXkS0 ewjb84dDDAcc8Rx4GMxbrJkJckUjM/qtr1xS+piasfPIPqRNApok7Yw+MOtE76twtO jOjIYZ6bXrCVUANUip+/s2ZikrDE8YiO1kIxmpuMBGiyng6DVyM+er2g9bqhNfxCb+ rgwxnWMcTxsMg== To: Tim Cross From: "M. Pger" Cc: emacs-orgmode@gnu.org Subject: Re: no syntax highlighting for code blocks with org-publish Message-ID: In-Reply-To: <864jzegk4q.fsf@gmail.com> References: <87zgh7i9vk.fsf@localhost> <864jzegk4q.fsf@gmail.com> Feedback-ID: 44058556:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=188.165.51.139; envelope-from=mpger@protonmail.com; helo=mail-0301.mail-europe.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "M. Pger" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658184987; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=sMovO5YHDbiFeb8QVSmm9DAccv3RzT57DT7KzI/oWfY=; b=jzQ0eqqMVPswCx+ITbUyJVbHBry6y+q1O4UtibukA3d3xabhw4+EJ12f7kZGPam5fMkbmG VmBjmhDPJlyuANJ/iCB5isFRU8y13C+8kAgqimT/z7P/wAW/3FgaezIbmU/Avlejk9tOwY j+D1dNZaF0jmN+dtjxvQhOXjJZpbU+B/UmS3wSTCnlrY4yp86DnuzP51a1mO+TekNDYASI XqvheDkAKS++xXT5qUI8ZQhC/I6WEvNMGFVhJkj3NYfLlhSW29vMd2EljiXwTOIZneTvgG DzPVfLDjWMBQDm53baZAxlIzSgXF1UWsK4ZRRgWRPs4E4n6QpnIPQiVqxXvAzg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658184987; a=rsa-sha256; cv=none; b=j0sjNoHYYHAYs1xMboSxdmNqDcMzJp2jdiO4v76f2XbFxmMC1lXzhwYcFU0UjWaaUtdAR7 MVTci/3eNgQEOVPTtqK2io7hGQIybzpleWUXem2AdXOzonDnNFCXfUE4jJ6e5TelKEMwTk RTVHzJqhg5TiALGxAHCePMi1HZwUTp6x39mmmjZLtL9n8znJYyzj5hgW8jdPzPzcOt52gy 8JJgfdtb2hHtrjNYUDmpJaPMeYVbHlsTmpVxjfln/duqX+r1BZOWEv6t4NPFYJVB9Hv401 qZXMvihkre8ZMRZ8GD50vDfSmbluG5t+Y+My3Q5PAeG8QnX5/s9knVEM9iiBDw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b=saHopKqG; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.74 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b=saHopKqG; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 014EE3FBE X-Spam-Score: -5.74 X-Migadu-Scanner: scn0.migadu.com X-TUID: OtWuLgoLvEFH Thanks for your suggestion. I added the following: #+begin_src elisp :eval no :exports code (setq my-var "org mailing list") (message "Hello, %s" my-var) #+end_src When exported with ~C-c C-e h o~, syntax highlighting is implemented (with = colors). When exported with org-publish interestingly I have no color, but = =3Dsetq=3D is in bold. Would it be possible that ox-publish implements some= kind of really basic builtin syntax highlighting and ignores htmlize? ------- Original Message ------- On Monday, July 18th, 2022 at 11:50 PM, Tim Cross w= rote: > "M. Pger" mpger@protonmail.com writes: > > > Thank you for your answer. Here it is: > > > > 1. Create the following directory structure (3 directories): > > ~/test/ > > =E2=94=9C=E2=94=80=E2=94=80 content > > =E2=94=9C=E2=94=80=E2=94=80 html > > =E2=94=94=E2=94=80=E2=94=80 .packages > > > > 2. Create the .el script to build the website (=3D~/test/build.el=3D): > > > > #+begin_src elisp > > ;; * Set the package installation directory (in order not to overwrite = the standard ~/emacs.d) > > (require 'package) > > (setq package-user-dir (expand-file-name "./.packages")) > > (setq package-archives '(("melpa" . "https://melpa.org/packages/"))) > > (add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/package= s/")) > > > > ;; * Initialize the package system > > (package-initialize) > > (unless package-archive-contents > > (package-refresh-contents)) > > > > ;; * Install dependencies > > ;; ** since org is builtin, by default Emacs does not try to install th= e latest version from Elpa (9.5.4) > > ;; the following solves the issue: > > (defun mpger-ignore-builtin (pkg) > > (assq-delete-all pkg package--builtins) > > (assq-delete-all pkg package--builtin-versions)) > > (mpger-ignore-builtin 'org) > > ;; ** install packages: > > (package-install 'org) > > (package-install 'htmlize) > > > > ;; * Load the publishing system: > > (require 'org) > > (require 'htmlize) > > (require 'ox-publish) > > > > ;; * Define the project > > (setq org-publish-project-alist > > (list > > (list "pages" > > :recursive t > > :htmlized-source t > > :base-directory "./content/" > > :base-extension "org" > > :publishing-directory "./html/" > > :publishing-function 'org-html-publish-to-html > > :with-creator t > > :with-toc t > > :section-numbers nil > > :time-stamp-file nil) > > )) > > > > ;; * Generate the site output > > (org-publish-all t) > > > > (message "Done!") > > #+end_src > > > > 3. In =3D~/test/content/=3D, create a simple test.org file to be publis= hed as html (=3D~/test/content/test.org=3D): > > > > #+begin_example > > * Here's some text > > > > Lorem ipsum. > > > > * Here's some code > > > > #+begin_src R :results output :exports both > > df <- mtcars ## a comment > > library(parallel) > > #+end_src > > > > #+end_example > > > > 4. Run =3D~/test/build.el=3D (e.g. with ~emacs -Q --script ~/test/build= .el~) and compare with > > the output from ~C-c C-e h o~. The latter has syntax highlighting, the = former has not. > > > Just a shot in the dark. Does syntax highlighting work if the source > block is something like emacs-lisp rather than R? > > I know that syntax highlighting is based on the syntax highlighting from > the mode used for a specific language. I'm wondering if your not getting > syntax highlighting because in yhour publish script, R mode is not > loaded, but when you open the org file and do a 'normal' export, R is > loaded and so you get syntax highlighting. Therefore, I would try the > same experiment, but instead of a source block of R code, I would try a > source block of emacs-lisp code as we know that emacs-lisp mode will be > loaded. > > Could be completely off track though!