简体   繁体   中英

Is There Anyway To Make Custom BBCode?

I have my own forum, currently I have features like editing, deleting and reporting both posts and replies but now I want to add features like BBCode. Right now I only want to try a [QUOTE][/QUOTE] feature where if the user selects the quote button it will take the quoted post, place it in a textarea with the quotes around the text. Then when it is submitted the page displays the quoted persons name and quote along with users post.

Eg [QUOTE name=Jane]This is a quote[/QUOTE] Hello.

"Originally posted by Jane: This is a quote." Hello.

I'm sure I could use JavaScript / AJAX to get the user quoted and putting their post in a textarea with the [QUOTE] tags but not sure about have it display when the page loads as the example I mentioned about.

If I can get this to work I could expand on other BBCode but right now this is the major feature I want.

It will probably be easier to use a third-party BBCode parser than to write your own, and then either use configuration to disallow other formatting options, or to remove those tags from the text.

If you choose to write your own parser, I recommend a test-driven approach. It can be tricky to handle things like escape characters, and there are often corner cases you may not discover right away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM