13

Possible Duplicate:
Adding a new link to a post messes up the code already present in the post

When adding / changing links in a post via the editor's "Hyperlink" button, the editor may renumber link references (e.g. if you insert a link at the top, it will have reference [1], and other existing links will have their numbers increased).

The problem is this: The editor will do its renumbering magic even if the bracket-number-bracket combination is inside a codeblock. So if I have this:

This code does not work:

    myarr[3][1] = 7;

plz help people of [stackoverflow][1]

  [1]: http://stackoverflow.com    

and then use Ctrl-L to insert a link at the top, the editor will not only add the link (and mysteriously duplicate the reference entry at the bottom), but also change the unrelated code:

This code from [the internet][1] does not work:

    myarr[3][2] = 7;

plz help people of [stackoverflow][3]


  [1]: http://google.com
  [2]: http://stackoverflow.com
  [3]: http://stackoverflow.com

This post on TeX.se is an example of where a user seems to have fought with this problem (see the revision history).

10
  • 1
    Why is it that the only image that pops into my mind, when I see [2][2], is a ballerina? – J. Steen Feb 4 '13 at 8:51
  • It's not a bug, it's a feature! :-) The editor saw you inserted a new link at the top numbered 1, and the rest of your link references were renumbered. And it is not very smart about that so all your 1 references where updated to 2, etc. – Martijn Pieters Feb 4 '13 at 8:58
  • 2
    @Martijn: Well yes, I know about this "feature"; I tried to describe it in my question. So I do understand (but not appreciate) the change of the numbers. But why on earth did my link to TeX.se get duplicated?? I inserted only two links, but now I have link numbers 1 to 3! – Hendrik Vogt Feb 4 '13 at 9:02
  • The parser is confused by the numbered 'links' that have no links. So a link reference was moved up slots in the array, moving from one, to two, to three as 'links' were reshuffled, but there was nothing moving up from 1 to 2 after it to overwrite things. That way you end up with duplicates. – Martijn Pieters Feb 4 '13 at 9:06
  • @Martijn: Ah, thanks! Now I understand also this part. – Hendrik Vogt Feb 4 '13 at 9:08
  • To fix this, the parser should not go into code blocks. – Shadow The Vaccinated Wizard Feb 4 '13 at 9:26
  • 4
    Sorry for defacing your post, but it took me ten minutes to understand what the bug was that you were reporting. Please have a look at the edit to make sure you're okay with it. – balpha Feb 4 '13 at 9:43
  • @balpha: I was just about to edit the post myself because I saw that it's hardly understandable. I couldn't have put it better than you did, thank you very much! – Hendrik Vogt Feb 4 '13 at 9:44
  • @J. Steen: I think you just answered your own question. – BoltClock's a Unicorn Feb 4 '13 at 9:49
  • @balpha illegaly? Hope no charges will be pressed! ;-) – Shadow The Vaccinated Wizard Feb 4 '13 at 11:28

Browse other questions tagged .