emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: mail@christianmoe.com
Cc: Bastien <bastien.guerry@wikimedia.fr>,
	emacs-orgmode@gnu.org, Vinh Nguyen <vinhdizzo@gmail.com>,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: text color + highlight
Date: Tue, 10 Aug 2010 09:06:56 -0600	[thread overview]
Message-ID: <87pqxq4icv.fsf@gmail.com> (raw)
In-Reply-To: <4C611C24.2030601@christianmoe.com> (Christian Moe's message of "Tue, 10 Aug 2010 11:30:12 +0200")

Hi Christian,

Christian Moe <mail@christianmoe.com> writes:

> Hi,
>
> I'm sorry my point was buried in quoted text. I did read Samuel's
> post. But my question was whether we couldn't *avoid inventing new
> syntaxes*, by using the already existing link syntax with custom links
> and export handlers (plus possibly some some new functionality to
> user-customize the faces of different link types in Org-mode).
>
> e.g.
>
> : [[color:red][some text in red]]
> : [[class:highlight][some highlighted text]]
>
>
> It's already trivial to write one's own `color' and `class' custom
> link types with export handlers to turn this into HTML such as:
>
> : <span style="color: red;">some text in red</span>
> : <span class="highlight">some highlighted text</span>
>

Thanks for making this suggestion.  This is a much better solution than
creating a new syntax out of whole cloth, I should have known that Org
would already have a working solution in place.

Just for completeness I'm adding an example of a color handler which can
be added to a users config to enable colorization of exported text to
html and latex.

--8<---------------cut here---------------start------------->8---
(org-add-link-type
 "color" nil
 (lambda (path desc format)
   (cond
    ((eq format 'html)
     (format "<span style=\"color:%s;\">%s</span>" path desc))
    ((eq format 'latex)
     (format "{\\color{%s}%s}" path desc)))))
--8<---------------cut here---------------end--------------->8---

it should be fairly straightforward to extend the above for background
or class link types

>
> (where the latter example would be styled by CSS).
>
> Doing this in exported text requires *no changes* to Org-mode. It also
> does not require finding one solution that fits everybody.
>
> If one wants Org text styled in these colors, highlights etc., I
> suppose it would require changes in Org-mode: not just
> user-customizable faces for different link types, as I wrote in the
> previous message, but a function to define link faces on the fly from
> the PATH part of the link.
>

I think in-buffer colorization is much less important than the export
behavior.

Cheers -- Eric

>
>
> Christian
>
> Carsten Dominik wrote:
>> Hi,
>>
>> Can we please first read Samuels post about extensible syntax?
>> Before we invent 20 other new syntaxes?
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/10204/focus=10204
>>
>> Thanks!
>>
>> On Aug 10, 2010, at 8:14 AM, Christian Moe wrote:
>>
>>> Hi,
>>>
>>> >>
>>> >> - this would be extensible, e.g.
>>> >>
>>> >>  [background[yellow] highlighted text]
>>> >>
>>> >>  could export to the following html
>>> >>
>>> >>  <span "style=background:yellow;">highlighted text</span>
>>> >>
>>> >> - this would avoid "{}"s
>>> >>
>>> >> - this would look more "org-like" than the pure latex solution
>>> >>
>>> >> the only issue with the above is that it may conflate a new /markup/
>>> >> syntax with org-mode's existing /link/ syntax.
>>> >>
>>> >> Thoughts? -- Eric
>>>
>>> I'd like an extensible inline markup construct (not primarily for
>>> coloring).
>>>
>>> Would it make sense to hijack custom links for this purpose, and
>>> use existing bracketed link syntax rather than add a new syntax?
>>>
>>> For semantic tagging (my chief interest), one might e.g. define a
>>> class' link type and an HTML export handler to wrap the contents in
>>> <span class="kewyord"> tags.
>>>
>>> : [[class:animals][some text about animals]]
>>>
>>> As for color: If one is satisfied with getting colors on export,
>>> defining a `color' link type and appropriate export handlers will
>>> do.
>>>
>>> : [[color:red][some colored text]]
>>>
>>> If one also wants the text to appear in the right color within
>>> Org-mode, and does not want the pseudo-link markup to be underlined
>>> and look like links, it would require additional Org functionality
>>> (I think): User-defined custom faces for different link types.
>>>
>>>>>> What syntax to use...
>>>>>
>>>>> I've thought briefly about the following syntax
>>>>>
>>>>> [color[red] text to be colored red]
>>>> Nope, I am against this syntax.  If we introduce a more general syntax,
>>>> then it should be done in the way Samuel proposed.  WHich means
>>>> we firs get a keyword indtroducing the piece, and then properties.
>>>> Like
>>>>   $[style :color red the red text]
>>>> or
>>>>   $[face :color :italic t red the red text]
>>>> Something like the $ before "[" also would seem critical to disambiguate
>>>> from other uses of "[".
>>>> However, I am not too excited about extra syntax to get this kind
>>>> of thing.
>>>> Would not oppose it, but probably never use it.
>>>> - Carsten
>>>
>>> Those examples are not very readable IMO -- without a separator
>>> it's hard to see where the property values end and the marked up
>>> text begins.
>>>
>>> Yours,
>>> Christian
>>
>> - Carsten
>>
>>
>>
>>
>> _______________________________________________
>> 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-10 15:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 20:42 text color + highlight Vinh Nguyen
2010-08-06  9:18 ` Bastien
2010-08-06 16:47   ` Vinh Nguyen
2010-08-06 20:28     ` Seweryn
2010-08-06 21:51     ` Eric Schulte
2010-08-06 23:42       ` Vinh Nguyen
2010-08-07  3:15         ` Eric Schulte
2010-08-07  3:57           ` Dan Davison
2010-08-08 14:59           ` Vinh Nguyen
2010-08-08 21:00             ` Eric Schulte
2010-08-09  6:28               ` Carsten Dominik
2010-08-09  7:37                 ` Robert Klein
2010-08-09  7:40                   ` Robert Klein
2010-08-10  6:14                 ` Christian Moe
2010-08-10  7:06                   ` Carsten Dominik
2010-08-10  9:30                     ` Christian Moe
2010-08-10 15:06                       ` Eric Schulte [this message]
2010-08-10 18:38                         ` Christian Moe
2010-08-10 21:39                           ` David Maus
2010-08-10 23:02                             ` Christian Moe
2010-08-10 23:47                               ` Eric Schulte
2010-08-11  6:48                     ` Dan Davison
2010-08-11 14:32                       ` Samuel Wales
2010-08-10 23:14                   ` Samuel Wales
2010-08-11  6:03                     ` Jan Böcker
2010-08-09  6:58               ` Eric Schulte
2010-08-09  7:05                 ` Samuel Wales
2010-08-09  5:17           ` Jambunathan K
2010-08-09  5:52             ` Noorul Islam K M
2010-08-07  4:52       ` Nick Dokos
2010-08-07 12:17       ` Sebastian Rose
2010-08-08 17:46         ` Samuel Wales
2010-09-09 16:15 ` Vinh Nguyen

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=87pqxq4icv.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=bastien.guerry@wikimedia.fr \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.com \
    --cc=vinhdizzo@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).