[docutils:feature-requests] #108 "title" option for the "image" directive

Günter Milde via Docutils-develop <[email protected]> Tue, 15 Oct 2024 19:57:33 -0000
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/feature-requests/108/0c430648ed11760de5c3a609bac00c8e72d6bddc.feature-requests@docutils.p.sourceforge.net>
If at all, an attribute/option to-be-translated to the HTML "title" attribute would come under a different name ( maybe "tooltip"):

* Looking at its [description in the HTML standard](https://html.spec.whatwg.org/multipage/dom.html#the-title-attribute), the title attribute is misnamed. It contains "advisory information" presented as a tooltip (if at all). 
* It can easily be confused with the HTML [`<title>` element](https://html.spec.whatwg.org/multipage/semantics.html#the-title-element).
* In  Docutils, there is already a ["title" attribute](https://docutils.sourceforge.io/docs/ref/doctree.html#title-1): Used on the `<document>` element for the "metadata title" (which corresponds to the HTML `<title>` element!

In HTML, "title" is one of the common attributes, supported by (almost) all elements. Where should Docutils/rST support stop?

The LaTeX package "pdfcomment" provides a `\pdftooltip` macro that may be used for
pop-ups in PDF output. Like the HTML "title" attribute, it may be used on paragraphs, tables, footnotes references...

However, whether support for an attribute you should not rely on is a valuable addition for a lightweight markup language remains questionable, especially as for the rare use cases exist workarounds in form of CSS rules or "raw" HTML.

Commit [r9950] adds support for class values on the figure caption. Now you can write:
~~~
.. figure:: meow.png
    .. class:: tooltip

   A siamese cat.
~~~
and style the resulting  HTML5 writer output with

     figcaption.tooltip {
       display: none;
       padding: 0.5em;
       width: 20vh;
       background: lightyellow;
       }
     figure:hover figcaption.tooltip { 
       display: block; 
       position: absolute;
       }

To suppress the tooltip in PDF output, convert with 

    rst2latex --strip-elements-with-class=tooltip



---

**[feature-requests:#108] "title" option for the "image" directive**

**Status:** open
**Group:** Default
**Created:** Sun Sep 29, 2024 08:41 AM UTC by toastal
**Last Updated:** Mon Oct 14, 2024 06:46 AM UTC
**Owner:** nobody


Like `image`’s `:alt:` directive, allow `:title:` for creating titles on pointer hover. The use case here is different from alt as alt is for assistive technologies & titles are more to give a labels for images for those with pointer cursors.

Expected input

~~~
.. image:: /house.jxl
	:alt: Home
	:title: Navigate home
	:target: /

.. image:: /cat.jxl
	:alt: A Siamese cat on a chair
	:title: Chula says, “meow”
~~~

Expected HTML output

~~~
<a href="/"><img src="/house.jxl" alt="Home" title="Navigate home"></a>
<img src="/cat.jxl" alt="A Siamese cat on a chair" title="Chula says, “meow”">
~~~

~~~






---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/feature-requests/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.