Project

General

Profile

Actions

Patch #16313

closed

Allow to link to an anchor of the current wikipage

Added by Holger Just about 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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]]

Files

wiki_anchors.diff (728 Bytes) wiki_anchors.diff Holger Just, 2014-03-11 13:38
16313-test.diff (792 Bytes) 16313-test.diff Go MAEDA, 2018-01-08 05:16
16313-confusing-link@2x.png (27.4 KB) 16313-confusing-link@2x.png Go MAEDA, 2018-01-10 07:50
16313-update-help.diff (94.3 KB) 16313-update-help.diff Go MAEDA, 2018-06-03 11:45
16313-update-help-v2.diff (97.6 KB) 16313-update-help-v2.diff Go MAEDA, 2018-06-05 06:21

Related issues

Related to Redmine - Feature #17455: Easier anchor linking / Textile anchor linksNew

Actions
Related to Redmine - Patch #28998: Japanese wiki help translation update (r17367)ClosedGo MAEDA

Actions
Related to Redmine - Defect #12981: Wiki self-link with anchor looks strange in "preview" section.Closed

Actions
Has duplicate Redmine - Feature #18043: Links to anchors inside the page should be pagename-independentClosed

Actions
Actions #1

Updated by Go MAEDA over 6 years 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.

Actions #2

Updated by Go MAEDA over 6 years ago

Tests for this feature.

Actions #3

Updated by Go MAEDA over 6 years 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.

Actions #4

Updated by Go MAEDA about 6 years ago

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

Updated by Go MAEDA about 6 years 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.

Actions #6

Updated by Go MAEDA almost 6 years 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
Actions #7

Updated by Go MAEDA almost 6 years 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.

Actions #8

Updated by Go MAEDA almost 6 years 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>

Actions #9

Updated by Enziin System almost 6 years ago

Please push to Github.

Thanks.

Actions #10

Updated by Go MAEDA almost 6 years ago

Here is a patch for "Wiki formatting" documents.

Actions #11

Updated by Go MAEDA almost 6 years ago

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

Actions #12

Updated by Go MAEDA almost 6 years ago

  • Status changed from Reopened to Closed

Updated wiki help.

Actions #13

Updated by Go MAEDA almost 6 years ago

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

Updated by Go MAEDA over 4 years ago

  • Has duplicate Feature #18043: Links to anchors inside the page should be pagename-independent added
Actions #15

Updated by Go MAEDA almost 3 years ago

  • Related to Defect #12981: Wiki self-link with anchor looks strange in "preview" section. added
Actions

Also available in: Atom PDF