Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-20501

Mention macro is incorrectly generating whitespaces in the HTML

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      A wiki syntax like this

      test {{mention reference="XWiki.kbernick" anchor="XWiki-kbernick-i3phd9"/}} text after
      

      in a wiki page in XWiki/2.1 syntax seems to generate the following html:

      <p>test <a class="xwiki-mention user" data-reference="xwiki:XWiki.kbernick" href="/xwiki/bin/view/XWiki/kbernick" id="XWiki-kbernick-i3phd9">
      @Karsten Bernick
      </a> text after</p>
      

      (the newlines in the html above are the original ones).

      The newlines between the a tag and the label of the anchor element are actually relevant in HTML, they become whitespaces and are normalized together with the following whitespaces (the regular whitespace between the a ad the text) causing issues like XWIKI-20500 .

      Expected markup:
      There is no reason for the mention macro to not generate fully inline HTML, like this

      <p>test <a class="xwiki-mention user" data-reference="xwiki:XWiki.kbernick" href="/xwiki/bin/view/XWiki/kbernick" id="XWiki-kbernick-i3phd9">@Karsten Bernick</a> text after</p>
      

      with no newlines or spaces at all inside the a tag or in its label.

      Attachments

        Issue Links

          Activity

            People

              mleduc Manuel Leduc
              lucaa Anca Luca
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: