Extension:BBCode

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
BBCode

Release status: stable

Implementation Parser function
Description support for extended BBCode markup
Last version 0.9
License GPL v2
Download bbcode.zip (dead Link!)
Hooks used
ParserAfterTidy

ParserBeforeStrip

Check usage (experimental)

Contents

[edit] What can this extension do?

In addition to normal wiki markup, you can use BBcode markup as well. Additional features have been added to the BBcode markup while [img] has not been implemented.

[edit] Usage

supported tags:

  • [b] - bold
  • [i] - italics
  • [o] - overline
  • [u] - underline
  • [tt] - typewriter text
  • [sup] - superscript
  • [sub] - subscripts
  • [pre] - same as <pre>
  • [code] - same as <pre> but ignores wiki/bbcode markup
  • [color=color name|#hexcode] - sets text color
  • [bgcolor=color name|#hexcode] - sets text background color
  • [font=font family, font name] - sets font name/family
  • [font=normal] (use font inherited from DOM parent object)
  • [font=cursive] (cursive font)
  • [mono] and [font=mono|monospace|monospaced] (monospaced font)
  • [hr] and [line] - horizontal rule
  • [hr=PERCENT%|PIXELSpx] and [line=PERCENT%|PIXELSpx] - horizontal rule with restrictions
  • [float=left|right|top|bottom] - floats text to the left, right, top or bottom of the DOM parent object


examples:

  • [b] bold [/b]
  • [i] italics [/i]
  • [o] overline [/o] (cannot show in wiki markup)
  • [u] underline [/u]
  • [s] strikethrough] [/s]
  • [sup] superscript [/sup]
  • [sub] subscript [/sub]
  • [tt] typewriter text [/tt]
  • [color=red] red [/color]
  • [color=#FF0000] red [/color]
  • [bgcolor=yellow] yellow [/bgcolor]
  • [bgcolor=#FFFF00] yellow [/bgcolor]
  • (cannot show in wiki markup) [h1] through [h6] uses headers just like <h1> through <h6>
  • [br] make a line break just like <br /> does

  • [hr] and [line] make a horizontal rule just like <hr /> does

  • (cannot show in wiki markup) [hr=300px] and [line=300px] make a 300 pixel wide horizontal rule just like <hr width="300px" /> does
  • (cannot show in wiki markup) [hr=50%] and [line=50%] make a horizontal rule that is 50% the width of the window just like <hr width="50%" /> does
  • (cannot show in wiki markup) float text in an html direction like that → [float=right] float text right [/float]
  • (cannot show in wiki markup) [font=Courier, monospace] custom font family [/font]
    please use fonts that work on all platforms or one of the shortcuts below.
  • (cannot show in wiki markup) [font=mono] monospaced font shortcut [/font]
  • (cannot show in wiki markup) [font=cursive] cursive font shortcut [/font]
  • (cannot show in wiki markup) [font=normal] normal font shortcut [/font] is useful inside [pre] tags
  • the [pre] tag allows  you    to      have        preformatted      text    in  a spiffy box 
    
  • the [code] tag is like [pre] but all wiki markup is disabled and most bbcode is hidden.  '''not bold'''
    

[edit] Download instructions

download the zip here and extract it into the $IP/extensions directory.

[edit] Installation

To install this extension, add the following to LocalSettings.php:

#add configuration parameters here
require_once("$IP/extensions/BBCode/BBCode.php");


[edit] Configuration parameters


  • $allow_headers (bool) will enable or disable the [h1] through [h6] tags
    • default value: false

  • $allow_float (bool) will enable or disable the [float=left|right|top|bottom] tag
    • default value: false

  • $allow_complex_fonts (bool) will enable or disable the [font=font family, font name] tag
    • NOTE: regardless of the setting, [font=mono|cursive|normal] will still be usable
    • default value: false

  • $allow_cursive (bool) will enable or disable the [font=cursive] tag
    • NOTE: this is only honored if complex fonts are disabled
    • default value: false

  • $fixed_width_fonts (string) and $cursive_fonts (string) are the list of fonts to (try) use for monospace and cursive
    • NOTE: standard/multi-platform fonts: http://www.w3.org/TR/CSS2/fonts.html#generic-font-families
    • $fixed_width_fonts default value: Courier,'Lucida Console','DejaVu Sans Mono',monospace
    • $cursive_fonts default value: 'URW Chancery L','Apple Chancery','Monotype Corsiva','Lucida Calligraphy', cursive
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox