Adding more BBCode tags

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

Adding more BBCode tags

by v-rob » Post

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

Header

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>
` 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: 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
+ Spoiler
this-is-an-attachment.png
(298.34 KiB) Not downloaded yet
Image

Automatic URL (Can be disabled with Do not automatically parse URLs in the Options posting section): https://wiki.minetest.net
Forum Automatic URL: index.php
URL: http://www.wikipedia.org
Named URL: Minetest Github

Email: celeron55@gmail.com

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

[h]Header[/h]
[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=1][*]Numbers[/list]
[list=a][*]Lowercase[/list]
[list=A][*]Uppercase[/list]
[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>
` 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: 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
+ Spoiler
this-is-an-attachment.png
(298.34 KiB) Not downloaded yet
Image

Automatic URL (Can be disabled with Do not automatically parse URLs in the Options posting section): https://wiki.minetest.net
Forum Automatic URL: index.php
URL: http://www.wikipedia.org
Named URL: Minetest Github

Email: celeron55@gmail.com[/code]

Hopefully I didn't forget any tags.

Problems

Some random problems with the current BBCode:
  • 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 and make sure that every inside another has a corresponding [­/icode].
  • The
    + Spoiler

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

    [table]
    	[row]
    		[**]First Name:
    		[**]Last Name:
    		[**]Favourite Food:
    	[row]
    		[*]George
    		[*]Washington
    		[*]Grapes
    	[row]
    		[*=2x1]NoLastName
    		[*]Pizza
    [/table]
    • 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

    [list=def]
    	[*]Infinite Loop
    	[**]See "Loop, Infinite"
    	[*]Loop, Infinite
    	[**]See "Infinite Loop
    [/list]
Note: I used the [**] tag for table headers and definition list details because it fits in with the current list syntax well.

Conclusion

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
Calinou
Moderator
Posts: 3162
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: Adding more BBCode tags

by Calinou » Post

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest