In this HTML source:
<html> <head> <title>mark test</title> </head> <body> <h1>mark test</h1> <pre> <code data-trim> def add(a,b): <mark>return</mark> a+b </code> </pre> </body> </html>
<mark> is used to highlight some of the content of the
<pre><code> block. The marked code is highlighted by being rendered in a different style.
How can something similar be achieved with org export to HTML in
The following naive attempt does not work:
* Code #+BEGIN_SRC python def fib(n): if n < 2: <mark>return</mark> 1 return fib(n-1) + fib(n-2) #+END_SRC #+BEGIN_EXAMPLE def fib(n): if n < 2: <mark>return</mark> 1 return fib(n-1) + fib(n-2) #+END_EXAMPLE
[Bonus question: is there an HTML-independent way of highlighting parts of
Edit: as discussed in Picaud Vincent's answer the
ref mechanism doesn't do the job, because of the requirements:
- the highlight must be visible without the reader's intervention,
- it must be possible to highlight portions of lines, not just entire lines.