Steps to reproduce:
1. Create a dispatch with the following contents:
- Code: Select all
[box]
[list]
[/box]
[/list]
Lorem ipsum
[box] tag can be replaced with: [floatleft], [floatright], [sidebar], [align], [box], [size] may be some other tags. This tag must be closed before the [/list]. Content placed after the [/list] will leak outside the preview container. Example dispatch: https://www.nationstates.net/page=dispatch/id=1403142
2. Link this dispatch with the following code:
- Code: Select all
[list]https://www.nationstates.net/page=dispatch/id=1403142
3. Preview/post the telegram/dispatch/post and observe the "Lorem ipsum" string outside the dispatch preview container.
What happened here:
1. [list] tag is always replaced by NS BBCode processor with <ul>/<ol>, regardless of the existence of the closing tag [/list]. Same applies to the closing tag [/list].
2. [box] and other such tags are a little trickier - while they are checked for their closing counterpart tag, that appears to be done via regex or independent stacks, which allows for the classic invalid bracket sequence situation to occur, such as ([)] in this case, only with tags instead of brackets.
3. This results in the following server-rendered invalid html:
4. The web browser (Chrome, Firefox) attempts to fix it as follows, effectively moving the offending </ul> tag and the rest of the content after the dispatch preview container:
Expected behavior:
1. Improperly matched tags should not be converted to html
2. [list] tag should be properly matched with [/list] tag
3. Dispatch content should stay within the preview box
4. Server-rendered html should not be invalid
And it also would be nice to not have the full dispatch content posted in its preview box, especially since the majority of its content is not visible. Limiting the preview to first few hundred characters should be okay, but it would require proper handling of the BBCode tag stack.