Trevor Burnham
Trevor Burnham

Reputation: 77416

Italicize text containing a link

I have an RST where I want an italicized link. However, the markup

*Warning: `Watch this <http://www.youtube.com/watch?v=dQw4w9WgXcQ&ob=av3e>`_!*

renders in HTML as

<em>Warning: `Watch this <http://www.youtube.com/watch?v=dQw4w9WgXcQ&ob=av3e>`_!</em>

That is, the italics render but the link doesn't. How do I get italics around the link?

Upvotes: 25

Views: 2428

Answers (2)

Matt Pitkin
Matt Pitkin

Reputation: 6407

Another option in this case is to use unicode italic text:

𝘞𝘢𝘳𝘯𝘪𝘯𝘨: `𝘞𝘢𝘵𝘤𝘩 𝘵𝘩𝘪𝘴 <http://www.youtube.com/watch?v=dQw4w9WgXcQ&ob=av3e>`_!

Although this does mean that you are stuck with the specific formatting of those unicode characters (you can get a serif version too).

Upvotes: 0

Martin Ueding
Martin Ueding

Reputation: 8709

The problem is that reST markup cannot be nested.

I managed to get it work with this:

Warning: |text|_

.. _text: http://www.youtube.com/watch?v=dQw4w9WgXcQ&ob=av3e

.. |text| replace:: *Watch this*

Upvotes: 24

Related Questions