emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* HTML Syntax Highlighting Questions
@ 2011-05-30  0:50 Avdi Grimm
  2011-05-30  1:32 ` Jambunathan K
  2011-06-09  1:45 ` Avdi Grimm
  0 siblings, 2 replies; 6+ messages in thread
From: Avdi Grimm @ 2011-05-30  0:50 UTC (permalink / raw)
  To: emacs-orgmode

I feel like this is a stupid question, but I'm having trouble finding
the info I need.

How do I control syntax highlighting in HTML export?  Specifically, how can I:

A. Disable syntax highlighting entirely
B. Switch from inline colors to semantic tagging that I can style with
a stylesheet? I could swear that I've seen instructions about this
somewhere in the past.

Bonus question: why would HTML syntax highlighting come out monochrome
(as seen here: http://avdi.org/devblog/wp-content/uploads/2011/05/html.png)
when the export is done in batch mode from the command line? And, more
importantly, how can I fix it to generate full-color highlighting in
batch mode?

Thanks,

-- 
Avdi Grimm
http://avdi.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HTML Syntax Highlighting Questions
  2011-05-30  0:50 HTML Syntax Highlighting Questions Avdi Grimm
@ 2011-05-30  1:32 ` Jambunathan K
  2011-05-30  2:25   ` Avdi Grimm
  2011-06-09  1:45 ` Avdi Grimm
  1 sibling, 1 reply; 6+ messages in thread
From: Jambunathan K @ 2011-05-30  1:32 UTC (permalink / raw)
  To: avdi; +Cc: emacs-orgmode

Avdi Grimm <avdi@avdi.org> writes:

> I feel like this is a stupid question, but I'm having trouble finding
> the info I need.
>
> How do I control syntax highlighting in HTML export?  Specifically, how can I:
>
> A. Disable syntax highlighting entirely

Remove htmlize from your load path.

> B. Switch from inline colors to semantic tagging that I can style with
> a stylesheet? I could swear that I've seen instructions about this
> somewhere in the past.

Slightly off-topic. 

As part of my odt exporter work, I would very much want to have the
exported code snippets marked up, well, differently. i.e., I need
flexibility in *choosing* what the tag ought to be - what you call as
semantic tagging. To illustrate, what gets emitted as <span>...</span>
in html export should in it's odt equivalent be emitted as
<text:span>...</text:span>.

I have emphasized it elsewhere, I think Org should use htmlfontify and
not htmlize. The principle is that something that is right within the
core should be given preference to that which is "3 rd
party". Furthermore, htmlfontify can generate htmlized source code that
is cross-referenced based on a etags database. If you browse to

http://rtfm.etla.org/emacs/htmlfontify/src/htmlfontify.el.html

and click on some of the links within the body text you would see that
it jumps to their corresponding definitions.

>
> Bonus question: why would HTML syntax highlighting come out monochrome
> (as seen here: http://avdi.org/devblog/wp-content/uploads/2011/05/html.png)
> when the export is done in batch mode from the command line? And, more
> importantly, how can I fix it to generate full-color highlighting in
> batch mode?

Let me guess - It is either htmlize not being in your load path during
the batch run or font lock being not being explicity turned on during
the batch run or font-locking simply not making sense during batch
mode. Ultimately htmlize or for that matter htmlfontify seem to depend
on the fontification done by the fontification engine.

Jambunathan K.
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HTML Syntax Highlighting Questions
  2011-05-30  1:32 ` Jambunathan K
@ 2011-05-30  2:25   ` Avdi Grimm
  2011-05-30  3:20     ` Jambunathan K
  2011-05-30  4:47     ` Puneeth Chaganti
  0 siblings, 2 replies; 6+ messages in thread
From: Avdi Grimm @ 2011-05-30  2:25 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

On Sun, May 29, 2011 at 9:32 PM, Jambunathan K <kjambunathan@gmail.com> wrote:
> Let me guess - It is either htmlize not being in your load path during
> the batch run or font lock being not being explicity turned on during
> the batch run or font-locking simply not making sense during batch
> mode. Ultimately htmlize or for that matter htmlfontify seem to depend
> on the fontification done by the fontification engine.

Hm. Bonus question, then: source code highlighting via Pygments works
great with LaTeX export and the "minted" package. How hard would it be
to use Pygments instead of htmlize/htmlfontify for HTML-exported
syntax highlighting?

...and who do I need to buy beer for to make this happen, since I
don't have time to do it myself?

-- 
Avdi Grimm
http://avdi.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HTML Syntax Highlighting Questions
  2011-05-30  2:25   ` Avdi Grimm
@ 2011-05-30  3:20     ` Jambunathan K
  2011-05-30  4:47     ` Puneeth Chaganti
  1 sibling, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2011-05-30  3:20 UTC (permalink / raw)
  To: avdi; +Cc: emacs-orgmode

Avdi Grimm <avdi@avdi.org> writes:

> On Sun, May 29, 2011 at 9:32 PM, Jambunathan K <kjambunathan@gmail.com> wrote:
>> Let me guess - It is either htmlize not being in your load path during
>> the batch run or font lock being not being explicity turned on during
>> the batch run or font-locking simply not making sense during batch
>> mode. Ultimately htmlize or for that matter htmlfontify seem to depend
>> on the fontification done by the fontification engine.
>
> Hm. Bonus question, then: source code highlighting via Pygments works
> great with LaTeX export and the "minted" package. How hard would it be
> to use Pygments instead of htmlize/htmlfontify for HTML-exported
> syntax highlighting?
>
> ...and who do I need to buy beer for to make this happen, since I
> don't have time to do it myself?

May be you could buy yourself a beer.

AFAICS, htmlize generates the css based on face attributes. I am sure
you could improve the results by customizing your face definitions -
font-lock-keyword-face, font-lock-comment-face etc etc.

As someone who is authoring a book you requirements could be
stringent. May be you use latex for producing book digitally and html
for getting the word out and striving to have similar visual effects on
both the mediums.

Jambunathan K.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HTML Syntax Highlighting Questions
  2011-05-30  2:25   ` Avdi Grimm
  2011-05-30  3:20     ` Jambunathan K
@ 2011-05-30  4:47     ` Puneeth Chaganti
  1 sibling, 0 replies; 6+ messages in thread
From: Puneeth Chaganti @ 2011-05-30  4:47 UTC (permalink / raw)
  To: avdi; +Cc: emacs-orgmode, Jambunathan K

On Mon, May 30, 2011 at 7:55 AM, Avdi Grimm <avdi@avdi.org> wrote:
> On Sun, May 29, 2011 at 9:32 PM, Jambunathan K <kjambunathan@gmail.com> wrote:
>> Let me guess - It is either htmlize not being in your load path during
>> the batch run or font lock being not being explicity turned on during
>> the batch run or font-locking simply not making sense during batch
>> mode. Ultimately htmlize or for that matter htmlfontify seem to depend
>> on the fontification done by the fontification engine.
>
> Hm. Bonus question, then: source code highlighting via Pygments works
> great with LaTeX export and the "minted" package. How hard would it be
> to use Pygments instead of htmlize/htmlfontify for HTML-exported
> syntax highlighting?

I've some hackish code, which I use to publish my blog. It
essentially, looks at all the code blocks in the html output and
replaces them with Pygments output for them.  The code is here [1]

HTH,
Puneeth

[1] https://github.com/punchagan/org-hyde/blob/master/org-hyde.el#L109

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HTML Syntax Highlighting Questions
  2011-05-30  0:50 HTML Syntax Highlighting Questions Avdi Grimm
  2011-05-30  1:32 ` Jambunathan K
@ 2011-06-09  1:45 ` Avdi Grimm
  1 sibling, 0 replies; 6+ messages in thread
From: Avdi Grimm @ 2011-06-09  1:45 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, May 29, 2011 at 8:50 PM, Avdi Grimm <avdi@avdi.org> wrote:
> How do I control syntax highlighting in HTML export?  Specifically, how can I:
>
> A. Disable syntax highlighting entirely
> B. Switch from inline colors to semantic tagging that I can style with
> a stylesheet? I could swear that I've seen instructions about this
> somewhere in the past.

Aha! I revisited this question, and I found the relevant setting:
org-export-htmlize-output-type

From the docs:

   Output type to be used by htmlize when formatting code snippets.
   Choices are `css', to export the CSS selectors only, or `inline-css', to
   export the CSS attribute values inline in the HTML.  We use as default
   `inline-css', in order to make the resulting HTML self-containing.

   However, this will fail when using Emacs in batch mode for export, because
   then no rich font definitions are in place.  It will also not be good if
   people with different Emacs setup contribute HTML files to a website,
   because the fonts will represent the individual setups.  In these cases,
   it is much better to let Org/Htmlize assign classes only, and to use
   a style file to define the look of these classes.
   To get a start for your css file, start Emacs session and make sure that
   all the faces you are interested in are defined, for example by loading files
   in all modes you want.  Then, use the command
   M-x org-export-htmlize-generate-css to extract class definitions.

-- 
Avdi Grimm
http://avdi.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-09  1:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-30  0:50 HTML Syntax Highlighting Questions Avdi Grimm
2011-05-30  1:32 ` Jambunathan K
2011-05-30  2:25   ` Avdi Grimm
2011-05-30  3:20     ` Jambunathan K
2011-05-30  4:47     ` Puneeth Chaganti
2011-06-09  1:45 ` Avdi Grimm

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).