Skip to content

Target ids are sanitised, so may not align with e.g. references in ref roles #16

@mbercx

Description

@mbercx

Describe the bug

Underscores _ inside a target header seem to get converted into hyphens -, but not for the references. E.g. this .rst snippet:

.. _test_snippet:

.. code-block:: Python

    # This is a test snippet.

Dude, check out that :ref:`test snippet <test_snippet>`!

Gets converted into:

(test-snippet)=

```{code-block} Python

# This is a test snippet.

```#

Dude, check out that {ref}`test snippet <test_snippet>`!

Expected behavior

Either the underscores should be preserved, or both the target header and references should be converted into hyphens, in case this is preferred.

Environment

  • Python Version [e.g. 3.7.1]: 3.8.6
  • Package versions or output of jupyter-book --version:
    $ pip freeze | grep myst
    myst-nb==0.13.0a1
    myst-parser==0.14.0a2
    rst-to-myst==0.1.2
  • Operating System: macOS Big Sur 11.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions