Discussion:
[Docutils-users] Omit substitution text in section link?
Luis Gomez
2017-06-21 13:57:07 UTC
Permalink
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? If not, could this be considered for a
future feature?

Thanks!

Luis Gomez

p.s. I'm not subscribed to the mailing list.
David Goodger
2017-06-21 15:25:46 UTC
Permalink
Post by Luis Gomez
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
|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.
Post by Luis Gomez
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
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.

Loading...