confluence-publisher icon indicating copy to clipboard operation
confluence-publisher copied to clipboard

Cross page links with anchors are rendered incorrectly

Open leonard84 opened this issue 4 years ago • 1 comments

If you have a cross page link with an anchor <guideline-rest/hints-on-the-implementation-of-rest-services.adoc#title-section,Hints on the Implementation of REST services>> then it will not be a correct link.

From what I could tell inline_anchor.html.slim uses cross_page_xref? in helpers.rb, which uses str.end_with? ".html". This check is not correct for this case, as the string will be: guideline-rest/hints-on-the-implementation-of-rest-services.html#title-section.

I've changed it to

  def cross_page_xref? str
    str.include? ".html"
  end

And it now correctly renders a link to the other page, it does seem to omit the anchor tag, but at least the link is not totally broken anymore.

If we omit the anchor for the cross link <<guideline-rest/hints-on-the-implementation-of-rest-services.adoc,Hints on the Implementation of REST services>>, then asciidoctor complains.

asciidoctor: INFO: possible invalid reference: guideline-rest/hints-on-the-implementation-of-rest-services.adoc

leonard84 avatar Jul 29 '20 15:07 leonard84

Fixing this issue would be very helpful.

sureshkmit avatar Jun 21 '21 08:06 sureshkmit