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: David A. Gershman
Subject: Re: [O] HTML Export, CSS Styling
Date: Sat, 22 Aug 2015 13:12:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0

Thank you (and to Nicolas Goaziou and Scott Randby as well)!!!  After
going through so many docs, blogs, articles, etc., I must have just
skimmed over that first paragraph.  And, although it was not something
I've looked for, thanks for the quick intro to Macros!  That's something
new I'll now be reading up on until I have a headache. :)

Thank again!

On 08/22/2015 12:50 AM, Christian Moe wrote:
> 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]