emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Erik Iverson <eriki@ccbr.umn.edu>
To: "卓强 Will Zhuo" <zhuo.qiang@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to customize the org-mode's BEGIN_SRC HTML output
Date: Mon, 23 Aug 2010 14:03:23 -0500	[thread overview]
Message-ID: <4C72C5FB.2070700@ccbr.umn.edu> (raw)
In-Reply-To: <AANLkTinXuWJ3fUw+ePP31UDCEjds_MYX3umHbmHPN4n2@mail.gmail.com>

Hello Will,

I assume you don't want the htmlize.el functionality, which
syntax highlights the source code according to how you
have it in Emacs?

The way I ultimately ended up doing something similar was to
post-process the html file generated by the export process,
(there is probably a hook so you can do this automatically):

My wants required:

    (while (re-search-forward "<pre " nil t)
          (replace-match
           "<pre style=\"background-color:#FFFFE5; font-size:8pt\" "
           t nil))

You might also have to set org-export-htmlize-output-type to
something other than 'inline-css, but I'm not sure.

Hope this either helps, or that someone has a better way :).

--Erik


卓强 Will Zhuo wrote:
> Hi,
> 
> Recently I start blogging using org-mode, it works pretty well, except 
> that I would like to customize its output somehow and don't know how to 
> make it work.
> 
> Here's one of the cusomization requirement:
> 
> when putting source code in blog, I would like to use the plugin: 
> http://alexgorbatchev.com/SyntaxHighlighter/ which is basicly a 
> javascript frontend engine turning the following HTML to a nice looking 
> code snippet on the web brower.
> 
> <pre class="brush: js">
>     /**
>      * SyntaxHighlighter
>      */
>     function foo()
>     {
>         if (counter <= 10)
>             return;
>         // it works!
>     }
> </pre>
>  
> I would like to make my code snippets in the org files exporting exactly 
> what SyntaxHighlighter required (with a <pre class="brush: %(lanangue 
> name)> tag and plain source code in it only escape the special char)
> 
> However, I could not find a way:
> using #+BEGIN_EXAMPLE give me a <pre> tag with class="example" and some 
> <span> tag
> 
> using #+BEGIN_SRC give me a <pre> tag with class="src src-%(lanangue 
> name)" and a bunch of <span> in the code itself.
> 
> using #+BEGIN_HTML give me nothing and it does not escape special chars 
> like "<>" either.
> 
> And there seems no custmized variable which could control the "class" of 
> the <pre> tag.
> 
> My questions are:
> Is there some way to achive this?
> If it need hack , where should I modify el files to be able to get the 
> BEGIN_SRC works as my expected?
> Generally, how should one do this kind of customization and how to even 
> add another export format, is there any tutorial to startup ?
> 
> thanks for your help,
> ZHUO,Qiang
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-08-23 19:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23  9:41 How to customize the org-mode's BEGIN_SRC HTML output 卓强 Will Zhuo
2010-08-23 19:03 ` Erik Iverson [this message]
2010-08-26  3:22   ` Andrei Jirnyi
  -- strict thread matches above, loose matches on Subject: below --
2010-08-24 13:39 Benjamin Beckwith
2010-08-25  2:36 ` Rafael
2010-08-25  3:32 Benjamin Beckwith
2010-08-25  8:30 ` Eric S Fraga
2010-08-25 12:23   ` Rafael
2010-08-25 12:51     ` Puneeth
2010-08-26  1:54       ` Rafael
2010-08-29  9:37       ` Puneeth
2010-08-29 18:18         ` Rafael
2010-09-01 10:42           ` Puneeth
2010-09-01 14:38             ` Rafael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C72C5FB.2070700@ccbr.umn.edu \
    --to=eriki@ccbr.umn.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=zhuo.qiang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).