Defect #12981

Wiki self-link with anchor looks strange in "preview" section.

Added by Vadim Pushtaev almost 9 years ago. Updated 4 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:


Category:Text formatting
Target version:-
Resolution:Wont fix Affected version:2.2.2


My page named Wiki contains link [[Wiki#Section]]. It produces this HTML: <a href="#Section">Wiki</a> that looks great on the page, but look strange in preview section, while editing this page. In that case it directs me to /projects/project1/wiki/Wiki/edit#Section that is obviously wrong.

Self-link is considered like special case by this piece of code (app/helpers/application_helper.rb):

def parse_wiki_links
# ...
url = if anchor.present? && wiki_page.present? && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) && == wiki_page

As you can see, == wiki_page is not enough to make link local.

12981.diff Magnifier (5.56 KB) Vadim Pushtaev, 2013-11-14 08:29

Related issues

Related to Redmine - Patch #16313: Allow to link to an anchor of the current wikipage Closed


#1 Updated by Etienne Massip almost 9 years ago

Yes and no, links generated in preview are not really supposed to be functional so the case is not taken into account.

#2 Updated by wei hui over 8 years ago

  • File Screenshot_2013-01-21-09-14-40.png added

#3 Updated by Jean-Philippe Lang over 8 years ago

  • File deleted (Screenshot_2013-01-21-09-14-40.png)

#4 Updated by Vadim Pushtaev over 8 years ago

Is it really necessary to make link local? I mean, my browser doesn't refresh page anyway, even if full link to the same page is provided.

#5 Updated by Etienne Massip over 8 years ago

ItLs useful for HTML export.

#6 Updated by Vadim Pushtaev almost 8 years ago

I believe the appropriate strategy here is to never use local links in preview sections, it's pointless.


-<%= textilizable @text, :attachments => @attachments, :object => @previewed %>
+<%= textilizable @text, :attachments => @attachments, :object => @previewed, :wiki_links => :full %>

Patch with tests included.

#7 Updated by Vadim Pushtaev almost 8 years ago

  • Status changed from New to Resolved

#8 Updated by Go MAEDA 4 months ago

  • Status changed from Resolved to Closed
  • Resolution set to Wont fix

Please use [[#Section]] instead of [[Wiki#Section]] when you want to make a link to an anchor on the current page. The syntax is allowed since Redmine 4.0.0 (#16313). It should work as you expect.

#9 Updated by Go MAEDA 4 months ago

  • Related to Patch #16313: Allow to link to an anchor of the current wikipage added

Also available in: Atom PDF