See original post here: What's the easiest way to get a random number from 0 to 9 in c#


If I nest the link brackets within the bold tag it doesn't render correctly.

**However, you should re-use the random object you create above otherwise [the results won't be very random.]**[2]

However, you should re-use the random object you create above otherwise [the results won't be very random.]2

If I swap the link and bold closing brackets it does.

**However, you should re-use the random object you create above otherwise [the results won't be very random.**][2]

However, you should re-use the random object you create above otherwise the results won't be very random.

I think it should work in the former case, and have undefined results in the latter.

share|improve this question
1  
You do it manually, or by clicking the Hyperlink icon in the editor? (Or pressing CTRL+L) If manually, I don't think it's a bug. –  Shadow Wizard Aug 3 '11 at 11:04
    
I first made the hyperlink (clicking the icon), then i added text before it and added the asterisks manually. –  George Duckett Aug 3 '11 at 11:05
    
I think it's a bug, becuase it shouldn't matter how i arrived at the formatting that's in my post, the expectations is that the first should work (bold tag and hyperlink tag correctly nested) –  George Duckett Aug 3 '11 at 11:06
    
Just tested, doing it all by clicking buttons does it wrong too. –  George Duckett Aug 3 '11 at 11:07
add comment

1 Answer

up vote 13 down vote accepted

The hyperlink tag is made up of two components (three, if you count the link):

  1. The text [text here]
  2. The reference [1]
  3. The link [1]: link

You are inserting the bold syntax in the middle of parts 1 and 2, which is incorrect. The syntax highlighter is doing exactly what is being asked of it: making the text between ** and ** bold. The link is not rendering because the asterisks have broken the link syntax.

Manual steps

**However, you should re-use the random object you create above otherwise [the results won't be very random.]**[2]

should be:

**However, you should re-use the random object you create above otherwise [the results won't be very random.][2]**

which renders just fine: Test link

With editor buttons

Following your steps (with editor buttons): I first made the hyperlink (clicking the icon), then i added text before it and added the asterisks manually

  1. Link text => type text.
  2. Link text
  3. [Link text][2] => convert to link.
  4. Link text
  5. This is some [Link text][2] => Add preceding text.
  6. This is some Link text
  7. **This is some [Link text][2]** => highlight text and link and add bold.
  8. This is some Link text
share|improve this answer
    
+1 great answer, i was having exactly that problem, incorrectly splitting up the link. –  George Duckett Aug 3 '11 at 12:04
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .