confluencebuilder icon indicating copy to clipboard operation
confluencebuilder copied to clipboard

Table of Contents links do not work for sections with spaces in their name

Open adamtheturtle opened this issue 4 months ago • 1 comments

  • Visit https://sphinxcontrib-confluencebuilder.atlassian.net/wiki/spaces/STABLE/pages/501974500/Table+of+Contents+Fabric
  • Make the window short enough so that you can see the "Output" section but not the sections below
  • Click "Sub-section"
    • The page correctly scrolls to the "Sub-section" heading
  • Scroll back up to the "Output" section
  • Click "Section B"
    • The page does not scroll at all

adamtheturtle avatar Mar 03 '24 18:03 adamtheturtle

Looks like this got broken in v2.4 (appears to work in v2.3) when trying to address anchor link compatibility between different versions of the Confluence editors and rst/md (#866). When a correction can be made for this, the unit testing should be expanded to cover this use case to help avoid this from happening again.

jdknight avatar Mar 03 '24 18:03 jdknight

Changes (https://github.com/sphinx-contrib/confluencebuilder/pull/921) have been made to correct broken anchor links on pages using a v2 editor. This change has been added into the main branch and should be made available next stable release. This can be tested now by using the development version. Feel free to try it out ahead of time any report any issues you may have.

jdknight avatar Mar 16 '24 22:03 jdknight

Thank you @jdknight . I have tested this out and it works for the case mentioned in the issue description. However, it does not work for titles with apostrophes (and maybe other punctuation - I have not tested).

My local test:

Example TOC Demo
================

**Confluence TOC**

.. confluence_toc::
   :max-level: 3

**Local Contents**

.. contents::
   :local:
   :depth: 3

SimpleNoSpace
-------------

This always worked.

Has Space
---------

This does not work in 2.4.0, but does work on `main`.

HasApostrophe'
--------------

This does not work in the "Local Contents" TOC, but does work in the "Confluence TOC", even on `main`.

adamtheturtle avatar Mar 22 '24 16:03 adamtheturtle

Please let me know if you prefer for me to create a new issue for this.

adamtheturtle avatar Mar 22 '24 16:03 adamtheturtle

Forgot to explicitly mention this, but an additional pull request was made to address this issue (as best can be seen from limited testing). We now force URL encode any anchor links in v2, which looks to address anchor linking issues with various types of special characters. Hopefully this resolves most use cases; and any new that arise, we can create new issues and track any methods to address them.

Thanks again for trying out alternative characters and reporting the issue.

The change had been merged into the main branch and has been made available in the recent release. With v2.5 is now available on PyPI -- marking as closed.

jdknight avatar Apr 01 '24 03:04 jdknight

Great, thank you!

adamtheturtle avatar Apr 01 '24 10:04 adamtheturtle