Patch #16313

Allow to link to an anchor of the current wikipage

Added by Holger Just over 4 years ago. Updated 12 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Text formatting
Target version:4.0.0

Description

Currently, it is not possible to link to an anchor of the current wiki page without having to also mention the name of the current wiki page in the link. This becomes tedious quickly if there are many such links. Should the wiki page later be moved, these inline links become quickly obsolete.

The attached patch which we developed for one of our customers at Planio adds the possibility to link directly to an anchor using the following syntax:

  • simple link: [[#Anchor]]
  • link with custom text: [[#Anchor|Link Text]]

wiki_anchors.diff Magnifier (728 Bytes) Holger Just, 2014-03-11 13:38

16313-test.diff Magnifier (792 Bytes) Go MAEDA, 2018-01-08 05:16

16313-confusing-link@2x.png (27.4 KB) Go MAEDA, 2018-01-10 07:50

16313-update-help.diff Magnifier (94.3 KB) Go MAEDA, 2018-06-03 11:45

16313-update-help-v2.diff Magnifier (97.6 KB) Go MAEDA, 2018-06-05 06:21


Related issues

Related to Redmine - Feature #17455: Easier anchor linking / Textile anchor links New
Related to Redmine - Patch #28998: Japanese wiki help translation update (r17367) Closed

Associated revisions

Revision 17345
Added by Go MAEDA 28 days ago

Allow to link to an anchor of the current wiki page (#16313).

Patch by Holger Just.

Revision 17346
Added by Go MAEDA 28 days ago

Add test for r17345 (#16313).

Patch by Go MAEDA.

Revision 17367
Added by Go MAEDA 12 days ago

Updates wiki help: Link to an anchor of the current wikipage (#16313).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 7 months ago

  • Target version set to 4.1.0

I think the proposed behavior is more natural than the current behavior. Setting target version to 4.1.0.

#2 Updated by Go MAEDA 5 months ago

Tests for this feature.

#3 Updated by Go MAEDA 5 months ago

I found that the patch generates a confusing link in some cases. If an anchor consists of only numeric characters, the generated link looks like an issue.

#4 Updated by Go MAEDA 3 months ago

  • Related to Feature #17455: Easier anchor linking / Textile anchor links added

#5 Updated by Go MAEDA 3 months ago

Go MAEDA wrote:

I found that the patch generates a confusing link in some cases. If an anchor consists of only numeric characters, the generated link looks like an issue.

Does anyone have any comments on this behavior? I think this is acceptable because people rarely create wiki pages with such names.

#6 Updated by Go MAEDA 29 days ago

  • Subject changed from Allow to link to an achor of the current wikipage to Allow to link to an anchor of the current wikipage
  • Assignee set to Go MAEDA

#7 Updated by Go MAEDA 28 days ago

  • Status changed from New to Closed
  • Target version changed from 4.1.0 to 4.0.0

Committed. Thank you for sharing the patch.

#8 Updated by Go MAEDA 28 days ago

  • Status changed from Closed to Reopened

It would be better to update documents as well. I will make a patch to update documents for all languages.

Index: public/help/en/wiki_syntax_detailed_markdown.html
===================================================================
--- public/help/en/wiki_syntax_detailed_markdown.html    (revision 17345)
+++ public/help/en/wiki_syntax_detailed_markdown.html    (working copy)
@@ -24,6 +24,7 @@
         <ul>
             <li><strong>[[Guide]]</strong> displays a link to the page named 'Guide': <a href="#" class="wiki-page">Guide</a></li>
             <li><strong>[[Guide#further-reading]]</strong> takes you to the anchor "further-reading". Headings get automatically assigned anchors so that you can refer to them: <a href="#" class="wiki-page">Guide</a></li>
+            <li><strong>[[#further-reading]]</strong> link to the anchor "further-reading" of the current page: <a href="#" class="wiki-page">#further-reading</a></li>
             <li><strong>[[Guide|User manual]]</strong> displays a link to the same page but with a different text: <a href="#" class="wiki-page">User manual</a></li>
         </ul>

Index: public/help/en/wiki_syntax_detailed_textile.html
===================================================================
--- public/help/en/wiki_syntax_detailed_textile.html    (revision 17345)
+++ public/help/en/wiki_syntax_detailed_textile.html    (working copy)
@@ -24,6 +24,7 @@
         <ul>
             <li><strong>[[Guide]]</strong> displays a link to the page named 'Guide': <a href="#" class="wiki-page">Guide</a></li>
             <li><strong>[[Guide#further-reading]]</strong> takes you to the anchor "further-reading". Headings get automatically assigned anchors so that you can refer to them: <a href="#" class="wiki-page">Guide</a></li>
+            <li><strong>[[#further-reading]]</strong> link to the anchor "further-reading" of the current page: <a href="#" class="wiki-page">#further-reading</a></li>
             <li><strong>[[Guide|User manual]]</strong> displays a link to the same page but with a different text: <a href="#" class="wiki-page">User manual</a></li>
         </ul>

#9 Updated by Enziin System 19 days ago

Please push to Github.

Thanks.

#10 Updated by Go MAEDA 15 days ago

Here is a patch for "Wiki formatting" documents.

#11 Updated by Go MAEDA 13 days ago

Updated the patch for help files. I hadn't updated wiki_syntax_detailed_textile.html for fr, ru and zh.

#12 Updated by Go MAEDA 12 days ago

  • Status changed from Reopened to Closed

Updated wiki help.

#13 Updated by Go MAEDA 7 days ago

  • Related to Patch #28998: Japanese wiki help translation update (r17367) added

Also available in: Atom PDF