Weird Looking: BBCode Enhancements

BBCode Enhancements

May 20, 2005 4:34am (5 years, 2 months and 1 week ago)
tags: none
Comments on this site can include BBCode, with some enhancements.  This page is supposed to document those.

First and foremost, BBCode will always (¿usually?) parse to valid XHTML.  The form will also tell you if you do bad.

Then here are the extras:

You can specify alt text for images.
[img=alt text]URL[/img]

Syntax highlighting for code.  Supported styles are html, css, cpp, java, javascript, perl, php, sql, xml, bbcode and c#.
Visit the Highlighting Test page to see it in action.
[code=type]...[/code ]

Define an abbreviation
[abbr=abbreviation]abbr.[/abbr]

Define an acronym
[acronym=World Wide Web]WWW[/acronym]

Print text "right to left"
Why?  I don’t know, might be fun.
[rtl]...[/rtl]

Make struck striked stricken a line through text.
[s]...[/s]

These tags are just translated into their HTML equivalents.
[strong] [small] [big] [em]

Since I’m trying to adhere to the XHTML 1.1 strict DTD (which defines no <b>-type tags), these tags are translated into <span> tags with the appropriate style (em tags didn’t work right).
[u] [b] [i]

[=…=]: BBCodes are not parsed in that dot dot dot region there.

I’m playing around with having the code automatically add “curly quotation marks” and – em dashes (--).  Seems to be working ok.  I’m sure there are situations where it won’t work right.

I’d like to make it use <p> tags for double line breaks, but it would need to continue using <br /> for blocks which contain [quote] tags (<blockquote> can’t be nested in a <p>).  That’s a bit backwards to how it checks for nesting problems now (it ignores the nestee, not the nester).

More coming?  I’ll see what I can figure out.

Comments

May 23, 2005 12:30am
How about “…” changing into horizontal ellipses?  It make a nice subtle difference.  I guess any number of periods should be changed to an ellipse, since people tend to go crazy with them.

Leave a comment


Accepts BBCode with a few enhancements.