emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] HTML Export, CSS Styling


From: Christian Moe
Subject: Re: [O] HTML Export, CSS Styling
Date: Sat, 22 Aug 2015 09:50:12 +0200
User-agent: mu4e 0.9.9.5-dev6; emacs 24.4.1

Hi,

See the first paragraph of the section "Quoting HTML tags" in the
manual.

In your example, you could do:

    This is the paragraph body that will allow *bold* or /italic/ or
    even _underline_, but what if I want only @@html:<span style="color:
    red;">@@THIS@@html:</span>@@ word to have styling?  Such as making
    it red to indicate importance?

For repeat use and/or export of special styling to other backends than
ODT, you may want to simplify things a bit with macros.

Use e.g. this in the document head:

    #+MACRO: red @@html:<span style="color: red;">@@$1@@html:</span>@@

(reload the document or do C-c C-c on the above line to make Org notice
you've added it). Then you can do 

    I want not only {{{red(THIS)}}} word to have styling, but
    {{{red(THESE\, TOO)}}}.

Note that commas separate arguments to macros, so you need to
backslash-escape any commas appearing in the styled text, as in the
above example.

Going further, you can use a macro with two arguments to have a choice
of colors:

    #+MACRO: color @@html:<span style="color: $1;">@@$2@@html:</span>@@
   
    I want {{{color(red, THIS)}}} word to be colored red, but
    {{{color(green, THIS ONE)}}}? to be green.

where the first argument (before the unescaped comma) is a color keyword
or code CSS can recognize.

(As an alternative to macros, some people define their own link types
with concomitant export functions just for styling text and hiding all
the necessary brackets out of sight. Requires elisp, offends purist
views of what links should mean, and is bad for document
portability. Originally my idea, I'm afraid.)

Hope this helps,

Christian

David A. Gershman writes:

> I've been reading all evening about HTML exporting, style sheets, etc. 
> Maybe I've been inundated with information, but I haven't been able to
> determine an answer to my question: can text in the middle of a
> paragraph by styled?  For example:
>
> * Heading 1
>    This is the paragraph body that will allow *bold*
>    or /italic/ or even _underline_, but what if I want
>    only THIS word to have styling?  Such as making it
>    red to indicate importance?
>
>
> I'm working on lecture notes and I was planning on a <span></span> tag
> so I can set the color and, ultimately, a 'title' attribute for a
> definition when hovered.  However, I'm only finding the "#+HTML" feature
> within org which seems to need to be on a line of its own.  Howver, the
> export would convert:
>
>   This is the paragraph body that will allow *bold*
>    or /italic/ or even _underline_, but what if I want
>    only
>     #+HTML: <span.....>THIS</span>
>    word to have...
>
> to 3 different paragraphs:
>
>    This is the paragraph body that will allow *bold*
>    or /italic/ or even _underline_, but what if I want
>    only
>    THIS
>    word to have...
>
> Am I missing something or is "in-line styling" just not a feature within
> Org (yet?)?
>
> Thanks!
>
> --David




reply via email to

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