-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.txt
More file actions
executable file
·151 lines (106 loc) · 5.31 KB
/
index.txt
File metadata and controls
executable file
·151 lines (106 loc) · 5.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
title: BBCode
description: Converts BBCode syntax to HTML.
icon: >-
M12.04,2.5L9.53,5H14.53L12.04,2.5M4,7V20H20V7H4M12,0L17,5V5H20A2,2 0 0,1 22,7V20A2,2 0 0,1 20,22H4A2,2 0 0,1
2,20V7A2,2 0 0,1 4,5H7V5L12,0M7,18V14H12V18H7M14,17V10H18V17H14M6,12V9H11V12H6Z
color: '#0f709d'
author: Taufik Nurrohman
type: Markdown
version: 3.0.0
...
[BBCode](https://www.bbcode.org) is short for Bulletin Board Code. It is used as a way for formatting posts made on
message boards, blogs and more. It is similar to HTML in the sense that in BBCode one does also use tags to format
something specific (contained within the tag). In BBCode, tags are indicated by rectangular brackets surrounding a
keyword, which is in turn transformed into HTML before being delivered to a web browser.
BBCode was implemented as method of providing a safer and easier way of allowing posts to be formatted on forums. Before
BBCode forums sometimes allowed users to include HTML code in their posts, which had many security issues (i.e. the user
could execute JavaScript code, break the layout of the site and so on). With BBCode being parsed by the forum scripts,
it is easier to control what the user can do and can not do (allowing or not allowing specific BBCode tags).
This extension generates semantic HTML markup. Your site will be secure. All HTML code will be encoded in the output, no
matter if it is written inside or outside the code block, without exception.
### Usage
In your page header, add a `type` property with a value set to `BBCode` or `text/bbcode`:
<pre><code class="yaml">---
title: Page Title
description: Page description.
author: Taufik Nurrohman
type: BBCode
...
This is a [b]bold[/b] text :)</code></pre>
### Syntax
Here are the supported syntaxes. I intentionally did not include the <code>[color]</code>,
<code>[size]</code>, and other decorative syntax in this extension because it is too complex and makes the
text unpleasant to read.
#### Bold, Italic, Strike and Underline
<pre><code class="bbcode">[b]bold[/b]
[i]italic[/i]
[s]strike[/s]
[u]underline[/u]</code></pre>
Nesting is possible, but it won’t be as accurate as using native HTML elements. In some cases, your syntax combinations
may damage each other:
<pre><code class="bbcode">[b][i]bold and italic[/i][/b]</code></pre>
#### Code
BBCode syntax and smiley patterns written in the code block are not touched by the parser. Language classes are
supported on this extension to be combined with [Highlight](https://github.com/mecha-cms/x.highlight) extension and
such:
<pre><code class="bbcode">[code]
Code goes here…
[/code]
[code=js]
JavaScript code goes here…
[/code]</code></pre>
#### Image
For security reasons, this syntax will only display images if the image URL has an `.apng`, `.avif`, `.gif`, `.jpeg`,
`.jpg`, `.png`, `.svg`, or `.webp` extension at the end of the name:
<pre><code class="bbcode">[img]http://127.0.0.1/route/to/image.jpg[/img]</code></pre>
#### List
Add a number to turn the list into an ordered list. A given number greater than `1` will create a `start` attribute with
a value of that number added to the generated `<ol>` element. Nesting lists is not possible at this time:
<pre><code class="bbcode">[list]
* List item 1
* List item 2
* List item 3
[/list]
[list=1]
* List item 1
* List item 2
* List item 3
[/list]
[list=5]
* List item 1
* List item 2
* List item 3
[/list]</code></pre>
Several list syntax variants are available for compatibility reasons:
<pre><code class="bbcode">[list]
[*] List item 1
[*] List item 2
[*] List item 3
[/list]
[list]
[*]List item 1[/*]
[*]List item 2[/*]
[*]List item 3[/*]
[/list]</code></pre>
#### Quote
<pre><code class="bbcode">[quote]
Important quote goes here…
[/quote]</code></pre>
#### URL
<pre><code class="bbcode">[url]http://example.com[/url]
[url=http://example.com]Example[/url]</code></pre>
#### Smiley
This extension supports a small set of smiley graphics to enhance the appearance without making it look excessive. No
smiley code will be converted to images if it’s written in the HTML tags or code blocks:
<pre><code class="bbcode">:<span>cool</span>: :<span>grin</span>: :<span>hmm</span>: :<span>lol</span>: :<span>mad</span>: :<span>rolleyes</span>: :<span>sad</span>: :<span>smile</span>: :<span>straight</span>: :<span>tongue</span>: :<span>wink</span>: :<span>yikes</span>:</code></pre>
<pre><code class="bbcode">8<span></span>) 8<span></span>-) B<span></span>) B<span></span>-)
:<span></span>D :<span></span>-D
:<span></span>/ :<span></span>-/ :<span></span>\ :<span></span>-\
x<span></span>( x<span></span>-( X<span></span>( X<span></span>-(
:<span></span>( :<span></span>-( :<span></span>'( :<span></span>'-(
:<span></span>) :<span></span>-)
:<span></span>| :<span></span>-|
:<span></span>p :<span></span>-p :<span></span>P :<span></span>-P
;<span></span>) ;<span></span>-)
:<span></span>o :<span></span>-o :<span></span>O :<span></span>-O</code></pre>