0

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?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Leonardo
  • 1,533
  • 17
  • 28
  • 1
    Not very elegant, but still: https://stackoverflow.com/a/4836544/407651 – mzjn Mar 28 '22 at 18:59
  • Thanks for the link, I'll add it to the question. The point of this particular question is to understand why after almost twenty years there's no way to have inline formatting with Docutils. – Leonardo Mar 28 '22 at 20:14
  • To be clear, there is support for inline markup. The problem is nested inline markup. – mzjn Mar 29 '22 at 07:22
  • You can do this with MyST, which combines features of Markdown with reStructuredText. https://myst-parser.readthedocs.io/en/latest/ – Steve Piercy Mar 29 '22 at 10:16
  • Thanks for the comment! That's exactly what I ended up doing. – Leonardo Mar 29 '22 at 13:35
  • @mzjn, you're right, I've clarified the question to state "nested inline markup". – Leonardo Mar 29 '22 at 13:38

0 Answers0