1 year ago

#346048

test-img

Leonardo

Sphinx can't generate link text as literal

With Markdown, I can simply:

[`a link with monospace font`](https://www.example.com)

a link with monospace font

Note how the above line is properly rendered by SO's MD renderer: the link text is in code (monospace) syntax.

I'm trying to achieve the same with reST:

I've tried to do this in reST with

```a link with monospace font`` <https://www.example.com>`_

But that breaks the linking, I get a monospaced text with a link with monospace font and then a link with https://www.example.com as the link text.

The problem seems to be Docutil's lack of support for nested inline markup. Frankly, I don't understand how's that possible. Docutils ToDo lists a discussion from 2001! We're in 2022! Not only this really basic feature is missing, but my impression is also that there's no real interest in ever implementing it.

I don't think the different workarounds are reasonable for such a simple feature.

Pandoc has an open bug for the exact same problem/

How can I get an HTML link test rendered as a literal without any workaround when using reStructuredText?

python-sphinx

restructuredtext

docutils

0 Answers

Your Answer

Accepted video resources