Adding more BBCode tags

Post Reply
User avatar
v-rob
Developer
Posts: 970
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: 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
Plain spoiler
Spoiler
Titled spoiler
this-is-an-attachment.png
this-is-an-attachment.png (298.34 KiB) Viewed 543 times
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
Plain spoiler
Spoiler
Titled spoiler
this-is-an-attachment.png
this-is-an-attachment.png (298.34 KiB) Viewed 543 times
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
    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 https://forum.minetest.net/ 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

    [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.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

User avatar
Calinou
Moderator
Posts: 3169
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: BuckarooBanzay and 9 guests