sphinx-doc / sphinx-doc/sphinx

Reference to heading with literal is not rendered as literal

Open
#6,522 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

domains:std type:enhancement
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Using a :ref: to a label of a heading that contains a literal is not rendered as a literal (monospaced font)

To Reproduce
Steps to reproduce the behavior:

###
Bla
###

.. _mylabel:

This header has a ``literal``
=============================

This is a reference to the header above :ref:`mylabel`

Produces the following HTML and PDF:

Screen Shot 2019-06-25 at 16 06 51 Screen Shot 2019-06-25 at 16 06 59

Expected behavior
The word "literal" in the reference to be in a monospaced font (as well as in italics in PDF)

Environment info

  • Sphinx version: 1.8.5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided reStructuredText reproduction using the :ref: link and compare its HTML and PDF output. Trace how the heading label is resolved and rendered, then verify that the literal text remains monospaced in HTML and monospaced and italicized in PDF.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.