Re: Omit substitution text in section link?

David Goodger <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <CABiJP=+18M3MqK1YfLJ3_zPNm0eznBvdhkOgqTQfngUOLjJv8Q@mail.gmail.com>
On Wed, Jun 21, 2017 at 8:57 AM, Luis Gomez <[email protected]> wrote:
> Hello,
>
> I'm using substitutions to insert images in section headings, but it's less
> than ideal when I have to link to those sections
>
> Take, for example, the following ReST:
>
> |icon1| My Section
> ================
>
> This will result in a section link of "icon1-my-section". To refer to this
> section elsewhere in the document, I have to write `icon1 My Section`_.
>
> I would like a way to allow that same section to be referred by `My
> Section`_, and the resulting link to be "my-section", as if the substitution
> text wasn't there. Is it possible to omit the text content of a substitution
> in a section heading?

Not currently.

Workaround that will give you what you want:

.. _My Section:

|icon1| My Section
================

If your output is HTML, you could also add an icon via CSS styling.

> If not, could this be considered for a future feature?

Please add a feature request, else it will be forgotten:
https://sourceforge.net/p/docutils/feature-requests/

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.