[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
HTML export: Force links that end in .jpg or .png to be exported as a ta
|
From: |
Rodrigo Morales |
|
Subject: |
HTML export: Force links that end in .jpg or .png to be exported as a tags |
|
Date: |
Wed, 17 Jul 2024 10:00:41 -0500 |
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?
- HTML export: Force links that end in .jpg or .png to be exported as a tags,
Rodrigo Morales <=