aboutsummaryrefslogtreecommitdiffstats
path: root/doc/en/member/bbcode.html
blob: e3e079b4d6ebad078ed35969c386fd6c37732305 (plain) (blame)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<style>
	section {
		display: inline-block;
		overflow-x: scroll;
	}
</style>
<h3>Text Decoration</h3>
<table class="table table-responsive table-bordered">
	<tbody>
		<tr>
			<th>BBcode syntax</th><th>Rendered text</th>
		</tr>
		<tr>
			<td><code>[b]bold[/b]</code></td><td><strong>bold</strong></td>
		</tr>
		<tr>
			<td><code>[i]italic[/i]</code></td><td><em>italic</em></td>
		</tr>
		<tr>
			<td><code>[u]underlined[/u]</code></td><td><u>underlined</u></td>
		</tr>
		<tr>
			<td><code>[s]strike[/s]</code></td><td><strike>strike</strike></td>
		</tr>
		<tr>
			<td><code>[color=red]red[/color]</code></td><td><span style="color:  red;">red</span></td>
		</tr>
		<tr>
			<td><code>[hl]highlighted[/hl]</code></td><td><span style="background-color: yellow;">highlighted</span></td>
		</tr>
		<tr>
			<td><code>[font=courier]some text[/font] </code></td><td><span style="font-family: courier;">some text</span></td>
		</tr>
		<tr>
			<td><code>[quote]quote[/quote]</code></td><td><blockquote>quote</blockquote></td>
		</tr>
		<tr>
			<td><code>[quote=Author]Author? Me? No, no, no...[/quote]</code></td><td><strong class="author">Author wrote:</strong><blockquote>Author? Me? No, no, no...</blockquote></td>
		</tr>
		<tr>
			<td><code>
					[size=small]small text[/size]<br>
					[size=xx-large]xx-large text[/size]<br>
					[size=20]20px exactly[/size]<br>
				</code>
				Size options include: <strong>xx-small, small, medium, large, xx-large</strong></td><td><span style="font-size: small;">small text</span><br><span style="font-size: xx-large;">xx-large text</span><br><span style="font-size: 20px;">20px exactly</span></td>
		</tr>
		<tr>
			<td><code>Add a horizontal bar
[hr]
Like this
				</code></td><td>
					Add a horizontal bar<br><hr><br>Like this
				</td>
		</tr>
		<tr>
			<td><code>This is
[center]centered[/center]
text</code></td><td>
					This is<br><div style="text-align:center;">centered</div><br>text
				</td>
		</tr>
	</tbody>
</table>

<h3>Code blocks</h3>
Code can be rendered generically in a block or inline format (depending on if there are new line characters in the text), or you can specify a supported language for enhanced syntax highlighting. Syntax highlighting requires a suitable rendering plugin such as <strong>hilite</strong>. Supported languages with the hilite plugin include <strong>php, css, mysql, sql, abap, diff, html, perl, ruby, vbscript, avrc, dtd, java, xml, cpp, python, javascript, js, json, sh </strong>. 
<br><br>
If a rendering plugin is not installed or an unsupported language is specified, the output for syntax highlighted code blocks is the same as the block format code tag.
<br><br> 
<table class="table table-responsive table-bordered">
	<tbody>
		<tr>
			<th>BBcode syntax</th><th>Output</th>
		</tr>
		<tr>
			<td><code>[code]function bbcode() { }[/code]</code></td><td><code>function bbcode() { }</code></td>
		</tr>
		<tr>
			<td><code>[code=php]function bbcode() {<br>
  $variable = true;<br>
  if( $variable ) {<br>
    echo "true";<br>
  }<br>
}[/code]</code></td><td><code><div class="hl-main"><ol class="hl-main"><li><span class="hl-code">&nbsp;</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">bbcode</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"></span></li><li><span class="hl-code">&nbsp;&nbsp;&nbsp;</span><span class="hl-var">$variable</span><span class="hl-code"> = </span><span class="hl-reserved">true</span><span class="hl-code">;</span></li><li><span class="hl-code">&nbsp;&nbsp;&nbsp;</span><span class="hl-reserved">if</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-var">$variable</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"></span></li><li><span class="hl-code">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="hl-reserved">echo</span><span class="hl-code"> </span><span class="hl-quotes">"</span><span class="hl-string">true</span><span class="hl-quotes">"</span><span class="hl-code">;</span></li><li><span class="hl-code">&nbsp;&nbsp;&nbsp;</span><span class="hl-brackets">}</span><span class="hl-code"></span></li><li><span class="hl-code">&nbsp;</span><span class="hl-brackets">}</span></li></ol></div></code></td>
		</tr>
		<tr>
			<td><code>[nobb][nobb]This is how [i]you[/i] can 
[u]show[/u] how to use 
[hl]BBcode[/hl] syntax[/nobb][/nobb]</code></td><td>[nobb]This is how [i]you[/i] can [u]show[/u] how to use [hl]BBcode[/hl] syntax[/nobb]</td>
		</tr>
	</tbody>
</table>

<h3>Lists</h3>
<table class="table table-responsive table-bordered">
	<tbody>
		<tr>
			<th>BBcode syntax</th><th>Rendered list</th>
		</tr>
		<tr>
			<td><code>[ul]<br>
[*] First list element<br>
[*] Second list element<br>
[/ul]</code></td><td><ul class="listbullet" style="list-style-type: circle;"><li> First list element</li><li> Second list element<br></li></ul></td>
		</tr>
		<tr>
			<td><code>[ol]<br>
[*] First list element<br>
[*] Second list element<br>
[/ol]</code></td><td><ul class="listdecimal" style="list-style-type: decimal;"><li> First list element</li><li> Second list element<br></li></ul></td>
		</tr>
		<tr>
			<td><code>[list=A]<br>
[*] First list element<br>
[*] Second list element<br>
[/list]</code>
				The list type options are <code>1, i, I, a, A</code>.</td><td><ul class="listupperalpha" style="list-style-type: upper-alpha;"><li> First list element</li><li> Second list element</li></ul></td>
		</tr>
		<tr>
			<td><code>[dl terms="b"]<br>
[*= First element term] First element description<br>
[*= Second element term] Second element description<br>
[/dl]</code>
				The <strong>terms</strong> style options can be any combination of:
	<dl class="bb-dl dl-horizontal">
	<dt>b</dt><dd>bold</dd>
	<dt>i</dt><dd>italic</dd>
	<dt>u</dt><dd>underline</dd>
	<dt>m</dt><dd>monospace</dd>
	<dt>l</dt><dd>large</dd>
	<dt>h</dt><dd>horizontal &mdash; like <em>this</em> defintion list</dd>
	</dl>
			</td><td><dl class="bb-dl dl-terms-bold">
<dt> First element term</dt><dd> First element description<br></dd>
<dt> Second element term</dt><dd> Second element description<br></dd></dl></td>
		</tr>
	</tbody>
</table>

<h3>Tables</h3>

<table class="table table-responsive table-bordered">
	<tbody>
		<tr>
			<th>BBcode syntax</th><th>Rendered table</th>
		</tr>
		<tr>
			<td><code>[table border=0]<br>
[tr]<br>
[th]Header 1[/th][th]Header 2[/th]<br>
[/tr]<br>
[tr][td]Content[/td][td]Content[/td][/tr]<br>
[tr][td]Content[/td][td]Content[/td][/tr]<br>
[/table]</code></td><td><table class="table table-responsive"><tbody><tr><th>Header 1</th><th>Header 2</th></tr>
<tr><td>Content</td><td>Content</td></tr><tr><td>Content</td><td>Content</td></tr></tbody></table></td>
		</tr>
		<tr>
			<td><code>[table border=1]<br>
[tr]<br>
[th]Header 1[/th][th]Header 2[/th]<br>
[/tr]<br>
[tr][td]Content[/td][td]Content[/td][/tr]<br>
[tr][td]Content[/td][td]Content[/td][/tr]<br>
[/table]</code></td><td><table class="table table-responsive table-bordered"><tbody><tr><th>Header 1</th><th>Header 2</th></tr>
<tr><td>Content</td><td>Content</td></tr><tr><td>Content</td><td>Content</td></tr></tbody></table></td>
		</tr>
		<tr>
			<td><code>[table]<br>
[tr]<br>
[th]Header 1[/th][th]Header 2[/th]<br>
[/tr]<br>
[tr][td]Content[/td][td]Content[/td][/tr]<br>
[tr][td]Content[/td][td]Content[/td][/tr]<br>
[/table]</code></td><td><table><tbody><tr><th>Header 1</th><th>Header 2</th></tr><tr><td>Content</td><td>Content</td></tr><tr><td>Content</td><td>Content</td></tr></tbody></table>
</td>
		</tr>
	</tbody>
</table>

<h3>Links and Embedded Content</h3>

<table class="table table-responsive table-bordered">
	<tbody>
		<tr>
			<th>BBcode syntax</th><th>Output</th>
		</tr>
		<tr>
			<td><code>[video]video URL[/video]<br>
[audio]audio URL[/audio]</code></td><td></td>
		</tr>
		<tr>
			<td><code>[url=https://hubzilla.org]Hubzilla[/url]</code></td><td><a href="https://hubzilla.org" target="_blank">Hubzilla</a></td>
		</tr>
		<tr>
			<td><code>An image [img]https://example.org/image.jpg[/img] 
in some text </code></td><td>
				An image <img src="/images/default_profile_photos/rainbow_man/48.jpg" alt="Image/photo"> in some text
			</td>
		</tr>
	</tbody>
</table>
	

<h3>$Projectname specific codes</h3>

<table class="table table-responsive table-bordered">
	<tbody>
		<tr>
			<th>BBcode syntax</th><th>Output</th>
		</tr>
		<tr>
			<td>Magic-auth version of [url] tag
				<code>[zrl=https://hubzilla.org]Identity-aware link[/zrl]</code>
			</td><td><code>https://hubzilla.org/?zid=[observer=1][observer.address][/observer][observer=0]your_channel@your.home.hub[/observer]</code></td>
		</tr>
		<tr>
			<td>Magic-auth version of [img] tag
				<code>[zmg]https://hubzilla.org/some/photo.jpg[/zmg]</code>
			</td><td>Image is only viewable by those authenticated and with permission.</td>
		</tr>
		<tr>
			<td>Observer-dependent output:<code>
				[nobb][observer=1]Text to display if observer IS authenticated[/observer][/nobb]
				</code></td><td></td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer=0]Text to display if observer IS NOT authenticated[/observer][/nobb]
				</code>
			</td>
			<td></td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.language=en]Text to display if observer language is English[/observer][/nobb]
				</code>
			</td>
			<td></td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.language!=de]Text to display if observer language is not German[/observer][/nobb]
				</code>
			</td>
			<td></td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.url][/nobb] 
				</code>
			</td>
			<td>channel URL of observer</td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.baseurl][/nobb] 
				</code>
			</td>
			<td>website of observer</td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.name][/nobb] 
				</code>
			</td>
			<td>name of observer</td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.webname][/nobb] 
				</code>
			</td>
			<td>short name in the url of the observer</td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.address][/nobb] 
				</code>
			</td>
			<td>address (ZOT-id) of observer</td>
		</tr>
		<tr>
			<td>
				<code>
				[nobb][observer.photo][/nobb] 
				</code>
			</td>
			<td>profile photo of observer</td>
		</tr>
		<tr>
			<td><code>What is a spoiler?<br>
					[spoiler]Text you want to hide.[/spoiler]</code></td><td>
					What is a spoiler? <div onclick="openClose('opendiv-1131603764'); return false;" class="fakelink">Click to open/close</div><blockquote id="opendiv-1131603764" style="display: none;">Text you want to hide.</blockquote>
				</td>
		</tr>
		<tr>
			<td><code>[toc data-toc='div.page-body' data-toc-headings='h1,h2']</code><br>
Create a table of content in a webpage or wiki page. Please refer to the <a href="http://ndabas.github.io/toc/" target="_blank">original jQuery toc</a> to get more explanations.
	<ul>
		<li>Optional param: 'data-toc'. If omitted the default is 'body'</li>
		<li>Optional param: 'data-toc-headings'. If omitted the default is 'h1,h2,h3'</li>
	</ul></td><td></td>
		</tr>
		<tr>
			<td><code>[nobb][rpost=title]Text to post[/rpost][/nobb]</code><br>
The observer will be returned to their home hub to enter a post with the specified title and body. Both are optional</td><td><a href="[baseurl]/rpost?f=&amp;title=title&amp;body=Text+to+post" target="_blank">[baseurl]/rpost?f=&amp;title=title&amp;body=Text+to+post</a></td>
		</tr>
		<tr>
			<td>This requires the <a href="https://framagit.org/hubzilla/addons/tree/master/qrator"><strong>qrator</strong></a> plugin.<br><code>[qr]text to post[/qr]</code></td><td><img src="/doc/member/assets/qr_text_to_post.png"></td>
		</tr>
		<tr>
			<td>This requires a suitable map plugin such as <strong><a href="https://framagit.org/hubzilla/addons/tree/master/openstreetmap">openstreetmap</a></strong>.
				<code>[map]</code></td><td>Generate an inline map using the current browser coordinates of the poster, if browser location is enabled</td>
		</tr>
		<tr>
			<td>This requires a suitable map plugin such as <strong><a href="https://framagit.org/hubzilla/addons/tree/master/openstreetmap">openstreetmap</a></strong>.
				<code>[map=latitude,longitude]</code></td><td>Generate a map using global coordinates.</td></tr>
		<tr>
			<td>This requires a suitable map plugin such as <strong><a href="https://framagit.org/hubzilla/addons/tree/master/openstreetmap">openstreetmap</a></strong>.
				<code>[map]Place Name[/map]</code></td><td>
Generate a map for a given named location. The first matching location is returned. For instance "Sydney" will usually return Sydney, Australia and not Sydney, Nova Scotia, Canada unless the more precise location is specified. It is highly recommended to use the post preview utility to ensure you have the correct location before submitting the post.
</td>
		</tr>
		<tr>
			<td><code>[&amp;copy;]</code></td><td> &copy; </td>
		</tr>
	</tbody>
</table>