Jason S
Jason S

Reputation: 189906

formatting a Sphinx reference

If I use this RST source:

- :ref:`Naming Convention <naming>` --- we consistently 
  followed a certain naming convention

then I can get output that looks like this

but what can I do to make "Naming Convention" boldface? RST doesn't seem to like the idea of nested formatting directives.

I've tried the suggestion in https://stackoverflow.com/a/4836544/44330 but it doesn't seem to work in this case (a :ref: rather than an HTML hyperlink)

I'm willing to write my own extension if necessary, as long as it's simple, but I don't know where to start.

Upvotes: 3

Views: 567

Answers (1)

ricardkelly
ricardkelly

Reputation: 2288

Does it help you to include a cssclass as the parent element of the reference? If the goal is to style link text selectively for specific links then you could do something like:

.. cssclass:: boldlink

:ref:`Naming Convention <naming>` --- we consistently followed a certain naming convention

Then define in custom.css:

.boldlink a { font-weight: bold; }

While you could override the CSS for all references, that would also restyle all the other links in the document:

span.std-ref { font-weight: bold; }

Upvotes: 4

Related Questions