emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* HTML Export, CSS Styling
@ 2015-08-22  4:13 David A. Gershman
  2015-08-22  7:50 ` Christian Moe
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: David A. Gershman @ 2015-08-22  4:13 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: HTML Export, CSS Styling
  2015-08-22  4:13 HTML Export, CSS Styling David A. Gershman
@ 2015-08-22  7:50 ` Christian Moe
  2015-08-22 20:12   ` David A. Gershman
  2015-08-22  7:52 ` Nicolas Goaziou
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Christian Moe @ 2015-08-22  7:50 UTC (permalink / raw)
  To: David A. Gershman; +Cc: emacs-orgmode

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

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

* Re: HTML Export, CSS Styling
  2015-08-22  4:13 HTML Export, CSS Styling David A. Gershman
  2015-08-22  7:50 ` Christian Moe
@ 2015-08-22  7:52 ` Nicolas Goaziou
  2015-08-22 15:52 ` Scott Randby
  2015-08-23 20:15 ` Rick Frankel
  3 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2015-08-22  7:52 UTC (permalink / raw)
  To: David A. Gershman; +Cc: emacs-orgmode

Hello,

"David A. Gershman" <gershman@dagertech.net> 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...

Inline HTML code require export snippets, e.g.,

  This is the paragraph body that will allow *bold* or /italic/ or even
  _underline_, but what if I want only @@html:<span>@@THIS@@html:</span>
  @@ word to have...


Regards,

-- 
Nicolas Goaziou

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

* Re: HTML Export, CSS Styling
  2015-08-22  4:13 HTML Export, CSS Styling David A. Gershman
  2015-08-22  7:50 ` Christian Moe
  2015-08-22  7:52 ` Nicolas Goaziou
@ 2015-08-22 15:52 ` Scott Randby
  2015-08-23 20:15 ` Rick Frankel
  3 siblings, 0 replies; 6+ messages in thread
From: Scott Randby @ 2015-08-22 15:52 UTC (permalink / raw)
  To: emacs-orgmode

On 08/22/2015 12:13 AM, David A. Gershman wrote:
> 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?)?

I use inline styling all the time with code like this: @@html:<i 
id="con">interest</i>@@

I set the properties of con in a stylesheet, but they can also be put 
into the org file directly.

Scott Randby

>
> Thanks!
>
> --David
>
>

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

* Re: HTML Export, CSS Styling
  2015-08-22  7:50 ` Christian Moe
@ 2015-08-22 20:12   ` David A. Gershman
  0 siblings, 0 replies; 6+ messages in thread
From: David A. Gershman @ 2015-08-22 20:12 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: HTML Export, CSS Styling
  2015-08-22  4:13 HTML Export, CSS Styling David A. Gershman
                   ` (2 preceding siblings ...)
  2015-08-22 15:52 ` Scott Randby
@ 2015-08-23 20:15 ` Rick Frankel
  3 siblings, 0 replies; 6+ messages in thread
From: Rick Frankel @ 2015-08-23 20:15 UTC (permalink / raw)
  To: emacs-orgmode

On Fri, Aug 21, 2015 at 09:13:13PM -0700, David A. Gershman wrote:
> 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?

Also, note that the above examples are exported by default as:

      - <b>bold</b>
      - <i>italic</i>
      - <span class="underline">underline</span>

So you can redefine the css associated with them if you want.

Also, you can customize `org-html-text-markup-alist' to change the markup.

rick

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

end of thread, other threads:[~2015-08-23 20:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-22  4:13 HTML Export, CSS Styling David A. Gershman
2015-08-22  7:50 ` Christian Moe
2015-08-22 20:12   ` David A. Gershman
2015-08-22  7:52 ` Nicolas Goaziou
2015-08-22 15:52 ` Scott Randby
2015-08-23 20:15 ` Rick Frankel

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