Skip to content

rST directive .. contents often generates wrong links (Confluence Cloud) #1121

@flichtenheld

Description

@flichtenheld

Given a document like

Testing Sphinx Confluence Builder 2.13.0 (with parentheses)
---------------------------------------------------------------------------------------

.. confluence_toc::

rst TOC:

.. contents:: Table of Contents

Overview
--------

Some content with `internal link`_.
And a second link: `other values`_.

Some Section
----------

Just add some text.

2.59.0 (Ubuntu 22)
++++++++++++++++++

Section title that contains parentheses.

The TOC generated by .. contents: often generates wrong links.

When using confluence_editor = v1, the correct links (according to confluence_toc) are:

#TestingSphinxConfluenceBuilder2.13.0(withparentheses)-Overview
#TestingSphinxConfluenceBuilder2.13.0(withparentheses)-Some-Space
#TestingSphinxConfluenceBuilder2.13.0(withparentheses)-2.59.0(Ubuntu22)

However, the links generated for .. contents:: are:

#Overview
#SomeSpace
#2.59.0(Ubuntu22)

When using confluence_editor = v2, the correct links are:

#%5BinlineExtension%5D%5BinlineExtension%5DOverview
#%5BinlineExtension%5D%5BinlineExtension%5DSome-Space
#2.59.0-(Ubuntu-22)

The links generated for .. contents:: are:

#Overview
#Some-Space
#[inlineExtension][inlineExtension]2.59.0-%28Ubuntu-22%29

(So exactly the wrong way around).

Note that for pages generated originally with confluence_editor = v1 and then updated with confluence_editor = v2, the behavior becomes even more confusing. The "correct" links are then:

#TestingSphinxConfluenceBuilder2.13.0(withparentheses)-OverviewTestingSphinxConfluenceBuilder2.13.0(withparentheses)-OverviewOverview
#TestingSphinxConfluenceBuilder2.13.0(withparentheses)-Some-SpaceTestingSphinxConfluenceBuilder2.13.0(withparentheses)-Some-SpaceSomeSpace
#TestingSphinxConfluenceBuilder2.13.0(withparentheses)-2.59.0(Ubuntu22)

Which might be a bug in Confluence?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that needs to be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions