From: Guenter M. <mi...@us...> - 2019-10-08 08:54:47
|
On 2019-10-07, Matthew Woehlke wrote: > On 07/10/2019 14.11, Guenter Milde via Docutils-users wrote: >> On 2019-10-07, Matthew Woehlke wrote: >>> What I want, ideally, is a role that takes its text and generates an >>> anchor from its text (i.e. sets the 'id' on its node to its contents), >>> *and also emits the text*. >> You may be looking for `inline internal targets`__. >> __ http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-internal-targets > Huh. Okay, that *sort of* works, but is there any way to style the text? Unfortunately, inline markup nesting is not supported. This is a long standing feature request. http://docutils.sourceforge.net/docs/dev/todo.html#nested-inline-markup > Also, the replacement of '.' with '-' is undesired and doesn't seem to > be necessary... The replacement is done in the ID, but not in the text or the "name" used for references to this target from other places in the rST document: This is the _`inline.target` I can link to it with `inline.target`_ in the rST source document. Other documents link to it as ``file:foo.html#inline-target`` The rationale was to make the ID compatible with both, HTML4.1 and CSS1 identifiers: http://docutils.sourceforge.net/docs/ref/rst/directives.html#rationale There is a feature request to lift these limitations https://sourceforge.net/p/docutils/feature-requests/66/ but we have to think about backwards compatibility (it would be a bad thing if re-compiling a document would break external links to it adapted to the current transformation without advance warning) and other output formats (LaTeX, manpage, ODT). Günter |