RpNation / bbcode

RpNation's Official BBCode Implementation for Discourse
GNU General Public License v3.0
1 stars 3 forks source link

Workaround to enable markdown tightly nested inside bbcode #73

Closed Alteras1 closed 8 months ago

Alteras1 commented 8 months ago

This is a bit of a brute force method to enable markdown parsing in scenarios where the markdown-it parser thinks it isn't a block/inline level.

Basically it forcefully adds "<!-- bbcode injected newlines -->\n\n" in each node level where there is a string. This is the trivial case I was testing with:

this is a test [nobr]**testing** of the prevent line break[br][/br]
*dfasd*
marker?[ooc]test**big**[/ooc][/nobr]
i guess
[newspaper][ooc]test[/ooc]
# check header here
**testing**[/newspaper]
- a
- b
- c

Opening draft PR for discussion as part of #32 for wider revisit on how line breaks work.

Also this might break on the markdown list and table scenario, since those are p heavily dependent on new lines. Not sure how exactly to force that case to happen tho...

This should also partially solve #72 issue with images tightly nested inside bbcode. Will need confirmation