Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert a link into bold text in reStructuredText

Tags:

I try to insert a link into bold text in reStructuredText but failed.

This is my rst source:

**Lorem ipsum dolor sit amet, `consectetur <http://www.example.com>`_  adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore  magna aliqua.** 

but I got:

<strong>Lorem ipsum dolor sit amet, `consectetur <http://www.example.com>`_  adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</strong> 

I want to get this:

<strong>Lorem ipsum dolor sit amet, <a href="http://www.example.com">consectetur</a>  adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</strong> 
like image 229
Zeyi Fan Avatar asked Mar 10 '12 09:03

Zeyi Fan


People also ask

How do I make text in href bold?

To bold the text in HTML, use either the strong tag or the b (bold) tag. Browsers will bold the text inside both of these tags the same, but the strong tag indicates that the text is of particular importance or urgency.

How do you bold the Sphinx?

Bold Text. Use double asterisks to show text as bold, or strong.


2 Answers

At the moment it seems that this is not possible: see the Docutils FAQ, specifically the question "Is nested inline markup possible". The answer basically states that nested inline markup is on the to do list, so it will eventually be possible to do what you ask in the question, and provides a couple of work arounds (which they state are not recommended).

Since the workarounds are not recommended perhaps for the time being you could just do something like:

**Lorem ipsum dolor sit amet,** `consectetur <http://www.example.com>`_  **adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore  magna aliqua.** 

Of course your link would not be bold, but at least it will be a valid link.

like image 131
Chris Avatar answered Sep 24 '22 14:09

Chris


One further workaround would be to mark the whole paragraph as bold, if applicable.

.. class:: bold  Lorem ipsum dolor sit amet, `consectetur <http://www.example.com>`_  adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore  magna aliqua. 
like image 45
Enrico Segre Avatar answered Sep 22 '22 14:09

Enrico Segre