all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* HTML export: Force links that end in .jpg or .png to be exported as a tags
@ 2024-07-17 15:00 Rodrigo Morales
  2024-07-17 15:06 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Morales @ 2024-07-17 15:00 UTC (permalink / raw)
  To: emacs-orgmode


Consider the following Org document:

#+HEADER: :tangle /tmp/a.org
#+BEGIN_SRC org
,#+TITLE: My document
,#+DATE: 2024-07-17

This is a link that ends in html: foo https://example.org/a.html bar

This is a link that ends in txt: foo https://example.org/a.txt bar

This is a link that ends in jpg: foo https://example.org/a.jpg bar

This is a link that ends in png: foo https://example.org/a.png bar
#+END_SRC

I started Emacs using the following command:

#+BEGIN_SRC sh
emacs \
  --quick \
  --eval='(find-file "/tmp/a.org")' \
  --eval='(org-html-export-as-html)'
#+END_SRC

The following code block shows the relevant content in the buffer =*Org HTML Export*=.

#+BEGIN_SRC html
<div id="content" class="content">
<h1 class="title">My document</h1>
<p>
This is a link that ends in html: foo <a href="https://example.org/a.html">https://example.org/a.html</a> bar
</p>

<p>
This is a link that ends in txt: foo <a href="https://example.org/a.txt">https://example.org/a.txt</a> bar
</p>

<p>
This is a link that ends in jpg: foo <img src="https://example.org/a.jpg" alt="a.jpg" /> bar
</p>

<p>
This is a link that ends in png: foo <img src="https://example.org/a.png" alt="a.png" /> bar
</p>
</div>
#+END_SRC

As we can see above, links that end in =html= or =txt= are exported as =a= tags, while links that end in =jpg= or =png= are exported as =img= tags.

I want links that end in =.jpg= or =.png= to also be =a= tags. The
reason is that in my use case, I need to display a link (i.e. a =a= tag)
inside a paragraph of an image hosted at Wikimedia Commons in the HTML
export. For example: https://commons.wikimedia.org/wiki/File:Banana_on_whitebackground.jpg

My question is: How to force a link that end in =.jpg= or =.png= to be exported as a =a= tag instead of an =img= tag?


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

end of thread, other threads:[~2024-07-17 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17 15:00 HTML export: Force links that end in .jpg or .png to be exported as a tags Rodrigo Morales
2024-07-17 15:06 ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.