emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Customize html formatting tags for export
@ 2015-01-28 20:40 Tory S. Anderson
  2015-01-28 21:01 ` Marcin Borkowski
  0 siblings, 1 reply; 5+ messages in thread
From: Tory S. Anderson @ 2015-01-28 20:40 UTC (permalink / raw)
  To: orgmode list

Right now I see that =formatted= and ~formatted~ both produce <code>formatted</code> when exported to html. How can I change one of these, perhaps to a custom tag (in particular, I'm hoping to produce <kbd>formatted</kbd>)? 

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

* Re: Customize html formatting tags for export
  2015-01-28 20:40 Customize html formatting tags for export Tory S. Anderson
@ 2015-01-28 21:01 ` Marcin Borkowski
  2015-01-29 10:55   ` Tory S. Anderson
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Borkowski @ 2015-01-28 21:01 UTC (permalink / raw)
  To: orgmode list


On 2015-01-28, at 21:40, Tory S. Anderson <torys.anderson@gmail.com> wrote:

> Right now I see that =formatted= and ~formatted~ both produce <code>formatted</code> when exported to html. How can I change one of these, perhaps to a custom tag (in particular, I'm hoping to produce <kbd>formatted</kbd>)? 

See ox-html.  There are functions org-html-verbatim and org-html-code.
If you look at those, you can see that (even though it might be
a quick-and-dirty hack) customizing org-html-text-markup-alist should
work.  You might even utilize the strike-through, if you never use it.

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

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

* Re: Customize html formatting tags for export
  2015-01-28 21:01 ` Marcin Borkowski
@ 2015-01-29 10:55   ` Tory S. Anderson
  2015-01-29 11:00     ` Sebastien Vauban
  2015-01-29 11:10     ` Marcin Borkowski
  0 siblings, 2 replies; 5+ messages in thread
From: Tory S. Anderson @ 2015-01-29 10:55 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: orgmode list

Thanks. With that info I did this: 

--8<---------------cut here---------------start------------->8---
;; convert =C-x=a to <kbd>C-x</kbd>, *awesome* to <strong>awesome</strong>
(setq org-html-text-markup-alist   '((bold . "<strong>%s</strong>") ; *text*
    (code . "<code>%s</code>") ; ~text~
    (italic . "<i>%s</i>") ; /text/
    (strike-through . "<del>%s</del>") ; +text+
    (underline . "<span class=\"underline\">%s</span>") ; _text_
    (verbatim . "<kbd>%s</kbd>"))) ; =text=
--8<---------------cut here---------------end--------------->8---

It seems to work great! I failed finding a way to make this just a buffer local change (e.g. only when I'm writing in my tech blog org file), but I can live with that. 

Note: I changed <b> to <strong> because I'm a web developer and most of the time <b> hurts my soul[1][2][3] ...

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

> On 2015-01-28, at 21:40, Tory S. Anderson <torys.anderson@gmail.com> wrote:
>
>> Right now I see that =formatted= and ~formatted~ both produce <code>formatted</code> when exported to html. How can I change one of these, perhaps to a custom tag (in particular, I'm hoping to produce <kbd>formatted</kbd>)? 
>
> See ox-html.  There are functions org-html-verbatim and org-html-code.
> If you look at those, you can see that (even though it might be
> a quick-and-dirty hack) customizing org-html-text-markup-alist should
> work.  You might even utilize the strike-through, if you never use it.
>
> Hth,

Footnotes: 
[1]  https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong
[2]  http://www.html-5-tutorial.com/strong-and-b-elements.htm
[3]  http://stackoverflow.com/questions/271743/whats-the-difference-between-b-and-strong-i-and-em

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

* Re: Customize html formatting tags for export
  2015-01-29 10:55   ` Tory S. Anderson
@ 2015-01-29 11:00     ` Sebastien Vauban
  2015-01-29 11:10     ` Marcin Borkowski
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastien Vauban @ 2015-01-29 11:00 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Tory,

> Note: I changed <b> to <strong> because I'm a web developer and most
> of the time <b> hurts my soul[1][2][3] ...

If I follow you, why don't you convert "i" to "em" as well?

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Customize html formatting tags for export
  2015-01-29 10:55   ` Tory S. Anderson
  2015-01-29 11:00     ` Sebastien Vauban
@ 2015-01-29 11:10     ` Marcin Borkowski
  1 sibling, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2015-01-29 11:10 UTC (permalink / raw)
  To: orgmode list


On 2015-01-29, at 11:55, Tory S. Anderson <torys.anderson@gmail.com> wrote:

> Thanks. With that info I did this: 
>
> --8<---------------cut here---------------start------------->8---
> ;; convert =C-x=a to <kbd>C-x</kbd>, *awesome* to <strong>awesome</strong>
> (setq org-html-text-markup-alist   '((bold . "<strong>%s</strong>") ; *text*
>     (code . "<code>%s</code>") ; ~text~
>     (italic . "<i>%s</i>") ; /text/
>     (strike-through . "<del>%s</del>") ; +text+
>     (underline . "<span class=\"underline\">%s</span>") ; _text_
>     (verbatim . "<kbd>%s</kbd>"))) ; =text=
> --8<---------------cut here---------------end--------------->8---
>
> It seems to work great! I failed finding a way to make this just a buffer local change (e.g. only when I'm writing in my tech blog org file), but I can live with that. 

While we are at dirty hacks: did you try make-local-variable (which see)?

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

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

end of thread, other threads:[~2015-01-29 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-28 20:40 Customize html formatting tags for export Tory S. Anderson
2015-01-28 21:01 ` Marcin Borkowski
2015-01-29 10:55   ` Tory S. Anderson
2015-01-29 11:00     ` Sebastien Vauban
2015-01-29 11:10     ` Marcin Borkowski

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