Adding more BBCode tags

User avatar
Posts: 700
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

Adding more BBCode tags

by v-rob » Sun Nov 24, 2019 00:19

So, the Minetest forums has a nice selection of BBCode tags, some of which are documented in the guide, but others which are documented nowhere, and you have to look at other posts (by quoting them and canceling without posting) to find out how to do them.

All the Tags


Bold, Italic, Underline, Strikethough, Inline Code, Olive Color, 120% of normal text size.

  1. Numbers
  1. Lowercase
  1. Uppercase
  1. Lowercase Roman Numerals
  1. Uppercase Roman Numerals
  • Bulleted list
    • Nested list
      • Doubly nested list

Code: Select all
// This is the PHP syntax highlighter.  Use `[code=php]<Your code here>[/code]` to apply.
$description = "This is some example PHP (I really don't know how it works, so I'm guessing).";
if (=== 1) {
    echo "Some text";
 else {
    echo "Never text";

Code: Select all
Code with no syntax highlighting.

Anonymous quote

Wikipedia wrote:Cheese is a dairy product derived from milk that is produced in a wide range of flavors, textures, and forms by coagulation of the milk protein casein.

+ Spoiler

+ Click Me!

(298.34 KiB) Not downloaded yet


Automatic URL (Can be disabled with Do not automatically parse URLs in the Options posting section):
Forum Automatic URL: index.php
Named URL: Minetest Github


And here's the source for all these (hopefully some people will find these useful; I had to figure them all out myself):

Code: Select all
[b]Bold[/b], [i]Italic[/i], [u]Underline[/u], [s]Strikethough[/s], [icode]Inline Code[/icode], [color=olive]Olive Color[/color], [size=120]120% of normal text size[/size].

[list=i][*]Lowercase Roman Numerals[/list]
[list=I][*]Uppercase Roman Numerals[/list]
[list][*]Bulleted list[list][*]Nested list[list][*]Doubly nested list[/list][/list][/list]

[code=php]// This is the PHP syntax highlighter.  Use `[code=php]<Your code here>[/code]` to apply.
$description = "This is some example PHP (I really don't know how it works, so I'm guessing).";
if (1 === 1) {
    echo "Some text";
} else {
    echo "Never text";

[code]Code with no syntax highlighting.[/code]

[quote]Anonymous quote[/quote]
[quote="Wikipedia"]Cheese is a dairy product derived from milk that is produced in a wide range of flavors, textures, and forms by coagulation of the milk protein casein.[/quote]

[spoiler]Plain spoiler[/spoiler]
[spoiler=Click Me!]Titled spoiler[/spoiler]


Automatic URL (Can be disabled with [icode]Do not automatically parse URLs[/icode] in the [icode]Options[/icode] posting section):
Forum Automatic URL:
URL: [url][/url]
Named URL: [url=]Minetest Github[/url]

Email: [email][/email]

Hopefully I didn't forget any tags.


Some random problems with the current BBCode:

  • [icode] will render styles inside of it, so trying to display [­b][­/b] requires a non-printable character inside the [­b] tag, which is annoying and hard to figure out.
    • Solution: don't render tags inside [icode] and make sure that every [icode] inside another [icode] has a corresponding [­/icode].
  • The [spoiler] tag requires JavaScript, or so I've heard.
    • Solution: use the <details> and <summary> HTML tags instead. This is not supported in Edge/IE, so some JavaScript would still be necessary to support those browsers, but not the wide variety that JavaScript dislikers use (i.e. Wuzzy, who probably doesn't use Edge/IE anyway)
  • Not all the tags are shown in the top bar of styling options. Things like spoilers, strikethrough, and headers should be there as well.
    • Solution: Put them there. Also, while we're at it, place code and icode next to each other so they are more logically grouped.
    • Also note: The Minetest BBCode Guide doesn't document all the tags, so they should be added.
  • The [­code] tag supports the php parameter, like [­code=php] for PHP syntax highlighting. This is rather useless and only exists because of the forum software. We should have some more useful syntax highlighting.
    • Solution: Add some more useful ones, specifically Lua and possibly C++.
  • Automatic Forum URLs (like index.php) have the prefix disappear when displayed, but if you click Preview, the prefix will also disappear in the editor, so you have to add back to the beginning again. This is a really, nasty, annoying bug, and if nothing else, this should be fixed.

Suggested Tags

The current BBCode tags are nice, but a few others would be quite useful as well:

  • Superscripts and subscripts: Simply [sup] and [sub] implemented as their HTML counterparts.
  • Tables: An example is better than anything else here:
    Code: Select all
          [**]First Name:
          [**]Last Name:
          [**]Favourite Food:

    • I suggest that the main tag is [table], with the [row] tag for the rows (<tr> HTML tag), the [**] tag for column tops (<th> HTML tag), and the [­*] tag, which is also used in [­list] (<td> HTML tag). None of the inner tags require a closing tag, since that would be redundant.
    • The [­*] and [­**] tags have an optional argument of [­*=<rowpan>x<colspan>]. Most markup languages, including Markdown, don't have this feature, and it can be quite annoying to not have.
    • Tables would have been useful in this post at the top where the tags were being displayed. In one column, I could show examples, and in the other, I could show the necessary code, instead of displaying all the code at the bottom, which is harder to read.
  • In the BBCode Problems section above, I used nested lists to show a problem and a corresponding solution. A better tag set for this would be the <dl>, <dt>, and <dd> HTML tags. My proposal for the BBCode implementation would be

    Code: Select all
       [*]Infinite Loop
       [**]See "Loop, Infinite"
       [*]Loop, Infinite
       [**]See "Infinite Loop

Note: I used the [**] tag for table headers and definition list details because it fits in with the current list syntax well.


I don't expect all of these problems/suggestions to be implemented; indeed, I hardly expect any of them to be implemented. Regardless, I hope the list of existing tags will be useful to someone. If I could help with any way to add some of these features or fix some problems, I would be most glad to help (I think there's a repo for the forums, right?).
Last edited by v-rob on Sun Nov 24, 2019 21:33, edited 1 time in total.

User avatar
Posts: 3158
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Adding more BBCode tags

by Calinou » Sun Nov 24, 2019 17:38

Thanks for making this post, it's an helpful reference :)

Return to Minetest-related projects

Who is online

Users browsing this forum: No registered users and 1 guest