Mature-IT.pro - Discussion for Experienced IT Professionals

Discussions => Public Discussion => Topic started by: benali72 on February 08, 2019, 09:28:50 pm

Title: html [ and ] vs < and >
Post by: benali72 on February 08, 2019, 09:28:50 pm
I always thought HTML used < and > for delimiters, as in < b > and < /b > for boldface.

But trying to post something the other day, a website insisted I use [ b ] and [ /b ] instead.  (And it had a different format for creating a Link using those delimiters).

I notice posting on this forum allows using either standard.

So why are there 2 standards for HTML delimiters? Is one newer than the other? More universal? I always thought is was just < and >.  I must have missed a memo somewhere.

Thanks!

Title: Re: html [ and ] vs < and >
Post by: The Gorn on February 08, 2019, 10:21:45 pm
< and > are for real HTML (web site code.) You'd never see [ and ] as tag delimiters in website code.

[ and ] are used in scripting languages such as "BBCode" (google it) which is a very simplified markup for forum users to accent their posts.

The idea is by disallowing angle bracket delimiters on tags (no "real" HTML) there is less of a risk of a forum user injecting harmful HTML such as Javascript into their post. BBCode has no equivalents for Javascript, CSS or other raw browser capabilities.
Title: Re: html [ and ] vs < and >
Post by: benali72 on February 10, 2019, 07:02:04 pm
Thank you, Gorn.  Yes, web site forum entry is exactly where I've seen the [  ]  business.

Unfortunately it means you can't paste your html into a forum post. Nor can you easily translate from one form to another (more than just the brackets are different, for example, the link format is also quite a bit different).

Thanks again! I knew the Gorn would nail this!
Title: Re: html [ and ] vs < and >
Post by: The Gorn on February 10, 2019, 07:28:24 pm
You're welcome and thanks.

I've always seen BBCode as partially a security measure (avoids backdoors by being a very small subset of functions) and partially to create a slightly simplified markup syntax for end users.

For instance, <script> introduces a Javascript. You don't want some forum user schmuck writing this in a post.

BBCode is a subset of HTML. It would be very easy to write a simple sed or awk script that translates BBcode into HTML. HTML to BBCode translation would amount to skipping anything in HTML that you can't do in BBCode. But otherwise trivial and easy also. You could probably google a canned  solution (prewritten script) for either problem, and sed exists for everything, Windows included.