Search code examples
javascriptparsingbbcode

Any good javascript BBCode parser?


Currently i'm parsing bbcode server side but i'd like to show a preview just like this site does.

If I process the bbcode serverside using ajax it's a bit laggy, so i thought doing it client side, to just show the preview.

Do you guys know any bbcode parser written in javascript?


Solution

  • I haven't personally used any Javascript BBcode parsers, but the top two Google results (bbcodejs and this blog post) seem pretty weak. The former only seems to support simple find-and-replace, and the latter seems to have pre-set BBcode built in, so you'd probably have to hack it a bit if you chose that solution.

    Your best options are probably to roll your own solution (possibly basing your work off one of the two links here), or just use AJAX and move on. That's probably the best way to ensure that previews are accurate, and previewing doesn't have to be real-time on every keypress, anyway; a delay before even sending the request is acceptable.