emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no syntax highlighting for code blocks with org-publish


From: M. Pger
Subject: Re: no syntax highlighting for code blocks with org-publish
Date: Tue, 19 Jul 2022 15:34:59 +0000

I tried to publish using `M-x org-publish RET <name_of_project> RET` as you 
suggested, and syntax highlighting was actually implemented, thanks.

Actually the problem is coming from the fact that I use `emacs -Q --script 
build.el` (as a bash script) to publish the project. According to 
https://list.orgmode.org/AE5693F1-F63D-4383-8840-0FD2DBAAC5D6@gmail.com/ 
(rather old, but apparently this has not changed), font-lock-mode is not 
enabled by default in --batch mode. Since `--script` "run Emacs in batch mode, 
like ‘--batch’, and then read and execute the Lisp code in file" (cf the doc), 
it seems that this is exactly my problem.

A workaround is suggested in 
https://list.orgmode.org/AE5693F1-F63D-4383-8840-0FD2DBAAC5D6@gmail.com/, but 
unfortunately for me it does not work (yet). I am going to dig further into 
that.

Best,

M



Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, July 19th, 2022 at 9:51 AM, Tim Cross <theophilusx@gmail.com> wrote:


> "M. Pger" mpger@protonmail.com writes:
>
> > 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 =setq= is in 
> > bold. Would it
> > be possible that ox-publish implements some kind of really basic builtin 
> > syntax
> > highlighting and ignores htmlize?
>
>
> I tried both exporting an org file into html and publishing and didn't
> get any syntax highlighting for either case. Had a closer look and
> noticed it didn't look like htmlize was being loaded. Did a (require
> 'htmlize) and did both an export and publish, betting syntax
> highlighting for both.
>
> My suspicion is that for the publish option, htmlize wasn't loaded?
> Maybe worth doing an explicit require and then call org-publish directly
> and see if that makes any difference.
>
> Below is the basic publish alist setting I used. Doubt all the slots are
> relevant - it was just a snippet from another project I grabbed to get
> setup.
>
> I also run M-x org-publish <ret> orgfiles <ret> rather than the export menu.
>
>
> (setq org-publish-project-alist
> '(("orgfiles"
> :base-directory "~/playground/org/"
> :base-extension "org"
> :recursive t
> :publishing-directory "~/Public"
> :publishing-function org-html-publish-to-html
> :exclude "PrivatePage.org"
> :html-style-default ""
> :html-scripts ""
> :html-htmlize-output-type 'inline-css
> :html-doctype "html5"
> :html-html5-fancy t
> :html-validation-link nil
> )))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]