This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Adapted from http://skeena.net/htmltobb/ | |
| var htmlToBBCode = function(html) { | |
| html = html.replace(/<pre(.*?)>(.*?)<\/pre>/gmi, "[code]$2[/code]"); | |
| html = html.replace(/<h[1-7](.*?)>(.*?)<\/h[1-7]>/, "\n[h]$2[/h]\n"); | |
| //paragraph handling: | |
| //- if a paragraph opens on the same line as another one closes, insert an extra blank line |