Add type-hint in ActivityPub\Receiver::fetchObject to catch wrong type coercion
[friendica.git/.git] / doc / BBCode.md
1 Friendica BBCode tags reference
2 ========================
3
4 * [Creating posts](help/Text_editor)
5
6 ## Inline
7
8 <style>
9 table.bbcodes {
10     margin: 1em 0;
11     background-color: #f9f9f9;
12     border: 1px solid #aaa;
13     border-collapse: collapse;
14     color: #000;
15     width: 100%;
16 }
17
18 table.bbcodes > tr > th,
19 table.bbcodes > tr > td,
20 table.bbcodes > * > tr > th,
21 table.bbcodes > * > tr > td {
22     border: 1px solid #aaa;
23     padding: 0.2em 0.4em
24 }
25
26 table.bbcodes > tr > th,
27 table.bbcodes > * > tr > th {
28     background-color: #f2f2f2;
29     text-align: center;
30     width: 50%
31 }
32 </style>
33
34 <table class="bbcodes">
35 <tr>
36   <th>BBCode</th>
37   <th>Result</th>
38 </tr>
39 <tr>
40   <td>[b]bold[/b]</td>
41   <td><strong>bold</strong></td>
42 </tr>
43 <tr>
44   <td>[i]italic[/i]</td>
45   <td><em>italic</em></td>
46 </tr>
47 <tr>
48   <td>[u]underlined[/u]</td>
49   <td><u>underlined</u></td>
50 </tr>
51 <tr>
52   <td>[s]strike[/s]</td>
53   <td><strike>strike</strike></td>
54 </tr>
55 <tr>
56   <td>[o]overline[/o]</td>
57   <td><span class="overline">overline</span></td>
58 </tr>
59 <tr>
60   <td>[color=red]red[/color]</td>
61   <td><span style="color:  red;">red</span></td>
62 </tr>
63 <tr>
64   <td>[url=http://friendi.ca]Friendica[/url]</td>
65   <td><a href="http://friendi.ca" target="external-link">Friendica</a></td>
66 </tr>
67 <tr>
68   <td>[img]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]</td>
69   <td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" alt="Immagine/foto"></td>
70 </tr>
71 <tr>
72   <td>[img=https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg]The Friendica Logo[/img]</td>
73   <td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" alt="The Friendica Logo"></td>
74 </tr>
75 <tr>
76   <td>[img=64x32]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]<br>
77 <br>Note: provided height is simply discarded.</td>
78   <td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" style="width: 64px;"></td>
79 </tr>
80 <tr>
81   <td>[size=xx-small]small text[/size]</td>
82   <td><span style="font-size: xx-small;">small text</span></td>
83 </tr>
84 <tr>
85   <td>[size=xx-large]big text[/size]</td>
86   <td><span style="font-size: xx-large;">big text</span></td>
87 </tr>
88 <tr>
89   <td>[size=20]exact size[/size] (size can be any number, in pixels)</td>
90   <td><span style="font-size: 20px;">exact size</span></td>
91 </tr>
92 <tr>
93   <td>[font=serif]Serif font[/font]</td>
94   <td><span style="font-family: serif;">Serif font</span></td>
95 </tr>
96 </table>
97
98 ### Links
99
100 <table class="bbcodes">
101 <tr>
102   <th>BBCode</th>
103   <th>Result</th>
104 </tr>
105 <tr>
106   <td>[url]http://friendi.ca[/url]</td>
107   <td><a href="http://friendi.ca">http://friendi.ca</a></td>
108 </tr>
109 <tr>
110   <td>[url=http://friendi.ca]Friendica[/url]</td>
111   <td><a href="http://friendi.ca">Friendica</a></td>
112 </tr>
113 <tr>
114   <td>[bookmark]http://friendi.ca[/bookmark]<br><br>
115 #^[url]http://friendi.ca[/url]</td>
116   <td><span class="oembed link"><h4>Friendica: <a href="http://friendi.ca" rel="oembed"></a><a href="http://friendi.ca" target="_blank">http://friendi.ca</a></h4></span></td>
117 </tr>
118 <tr>
119   <td>[bookmark=http://friendi.ca]Bookmark[/bookmark]<br><br>
120 #^[url=http://friendi.ca]Bookmark[/url]<br><br>
121 #[url=http://friendi.ca]^[/url][url=http://friendi.ca]Bookmark[/url]</td>
122   <td><span class="oembed link"><h4>Friendica: <a href="http://friendi.ca" rel="oembed"></a><a href="http://friendi.ca" target="_blank">Bookmark</a></h4></span></td>
123 </tr>
124 <tr>
125   <td>[url=/posts/f16d77b0630f0134740c0cc47a0ea02a]Diaspora post with GUID[/url]</td>
126   <td><a href="/display/f16d77b0630f0134740c0cc47a0ea02a" target="_blank">Diaspora post with GUID</a></td>
127 </tr>
128 <tr>
129   <td>#Friendica</td>
130   <td>#<a href="/search?tag=Friendica">Friendica</a></td>
131 </tr>
132 <tr>
133   <td>@Mention</td>
134   <td>@<a href="javascript:void(0)">Mention</a></td>
135 </tr>
136 <tr>
137   <td>acct:account@friendica.host.com (WebFinger)</td>
138   <td><a href="/acctlink?addr=account@friendica.host.com" target="extlink">acct:account@friendica.host.com</a></td>
139 </tr>
140 <tr>
141   <td>[mail]user@mail.example.com[/mail]</td>
142   <td><a href="mailto:user@mail.example.com">user@mail.example.com</a></td>
143 </tr>
144 <tr>
145   <td>[mail=user@mail.example.com]Send an email to User[/mail]</td>
146   <td><a href="mailto:user@mail.example.com">Send an email to User</a></td>
147 </tr>
148 </table>
149
150 ## Blocks
151
152 <table class="bbcodes">
153 <tr>
154   <th>BBCode</th>
155   <th>Result</th>
156 </tr>
157 <tr>
158   <td>[p]A paragraph of text[/p]</td>
159   <td><p>A paragraph of text</p></td>
160 </tr>
161 <tr>
162   <td>Inline [code]code[/code] in a paragraph</td>
163   <td>Inline <key>code</key> in a paragraph</td>
164 </tr>
165 <tr>
166   <td>[code]Multi<br>line<br>code[/code]</td>
167   <td><code>Multi
168 line
169 code</code></td>
170 </tr>
171 <tr>
172   <td>[code=php]function text_highlight($s,$lang)[/code]<sup><a href="#supported-code">1</a></sup></td>
173   <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">text_highlight</span><span class="hl-brackets">(</span><span class="hl-var">$s</span><span class="hl-code">,</span><span class="hl-var">$lang</span><span class="hl-brackets">)</span></li></ol></div></code></td>
174 </tr>
175 <tr>
176   <td>[quote]quote[/quote]</td>
177   <td><blockquote>quote</blockquote></td>
178 </tr>
179 <tr>
180   <td>[quote=Author]Author? Me? No, no, no...[/quote]</td>
181   <td><strong class="author">Author wrote:</strong><blockquote>Author? Me? No, no, no...</blockquote></td>
182 </tr>
183 <tr>
184   <td>[center]Centered text[/center]</td>
185   <td><div style="text-align:center;">Centered text</div></td>
186 </tr>
187 <tr>
188   <td>You should not read any further if you want to be surprised.[spoiler]There is a happy end.[/spoiler]</td>
189   <td>
190     <div class="wall-item-container">
191       You should not read any further if you want to be surprised.<br>
192       <span id="spoiler-wrap-0716e642" class="spoiler-wrap fakelink" onclick="openClose('spoiler-0716e642');">Click to open/close</span>
193       <blockquote class="spoiler" id="spoiler-0716e642" style="display: none;">There is a happy end.</blockquote>
194       <div class="body-attach"><div class="clear"></div></div>
195     </div>
196   </td>
197 </tr>
198 <tr>
199   <td>[spoiler=Author]Spoiler quote[/spoiler]</td>
200   <td>
201     <div class="wall-item-container">
202       <strong class="spoiler">Author wrote:</strong><br>
203       <span id="spoiler-wrap-a893765a" class="spoiler-wrap fakelink" onclick="openClose('spoiler-a893765a');">Click to open/close</span>
204       <blockquote class="spoiler" id="spoiler-a893765a" style="display: none;">Spoiler quote</blockquote>
205       <div class="body-attach"><div class="clear"></div></div>
206     </div>
207   </td>
208 </tr>
209 <tr>
210   <td>[hr] (horizontal line)</td>
211   <td><hr></td>
212 </tr>
213 </table>
214
215 <a name="supported-code">1</a>: Supported language parameter values for code highlighting:
216 - abap
217 - avrc
218 - cpp
219 - css
220 - diff
221 - dtd
222 - html
223 - java
224 - javascript
225 - js
226 - mysql
227 - perl
228 - php
229 - python
230 - ruby
231 - sh
232 - sql
233 - vbscript
234 - xml
235
236 ### Titles
237
238 <table class="bbcodes">
239 <tr>
240   <th>BBCode</th>
241   <th>Result</th>
242 </tr>
243 <tr>
244   <td>[h1]Title 1[/h1]</td>
245   <td><h1>Title 1</h1></td>
246 </tr>
247 <tr>
248   <td>[h2]Title 2[/h2]</td>
249   <td><h2>Title 2</h2></td>
250 </tr>
251 <tr>
252   <td>[h3]Title 3[/h3]</td>
253   <td><h3>Title 3</h3></td>
254 </tr>
255 <tr>
256   <td>[h4]Title 4[/h4]</td>
257   <td><h4>Title 4</h4></td>
258 </tr>
259 <tr>
260   <td>[h5]Title 5[/h5]</td>
261   <td><h5>Title 5</h5></td>
262 </tr>
263 <tr>
264   <td>[h6]Title 6[/h6]</td>
265   <td><h6>Title 6</h6></td>
266 </tr>
267 </table>
268
269 ### Tables
270
271 <table class="bbcodes">
272 <tr>
273   <th>BBCode</th>
274   <th>Result</th>
275 </tr>
276 <tr>
277   <td>[table]<br>
278 &nbsp;&nbsp;[tr]<br>
279 &nbsp;&nbsp;&nbsp;&nbsp;[th]Header 1[/th]<br>
280 &nbsp;&nbsp;&nbsp;&nbsp;[th]Header 2[/th]<br>
281 &nbsp;&nbsp;&nbsp;&nbsp;[th]Header 2[/th]<br>
282 &nbsp;&nbsp;[/tr]<br>
283 &nbsp;&nbsp;[tr]<br>
284 &nbsp;&nbsp;&nbsp;&nbsp;[td]Cell 1[/td]<br>
285 &nbsp;&nbsp;&nbsp;&nbsp;[td]Cell 2[/td]<br>
286 &nbsp;&nbsp;&nbsp;&nbsp;[td]Cell 3[/td]<br>
287 &nbsp;&nbsp;[/tr]<br>
288 &nbsp;&nbsp;[tr]<br>
289 &nbsp;&nbsp;&nbsp;&nbsp;[td]Cell 4[/td]<br>
290 &nbsp;&nbsp;&nbsp;&nbsp;[td]Cell 5[/td]<br>
291 &nbsp;&nbsp;&nbsp;&nbsp;[td]Cell 6[/td]<br>
292 &nbsp;&nbsp;[/tr]<br>
293 [/table]</td>
294   <td>
295         <table>
296       <tbody>
297         <tr>
298           <th>Header 1</th>
299           <th>Header 2</th>
300           <th>Header 3</th>
301         </tr>
302         <tr>
303           <td>Cell 1</td>
304           <td>Cell 2</td>
305           <td>Cell 3</td>
306         </tr>
307         <tr>
308           <td>Cell 4</td>
309           <td>Cell 5</td>
310           <td>Cell 6</td>
311         </tr>
312       </tbody>
313     </table>
314   </td>
315 </tr>
316 <tr>
317   <td>[table border=0]</td>
318   <td>
319         <table border="0">
320       <tbody>
321         <tr>
322           <th>Header 1</th>
323           <th>Header 2</th>
324           <th>Header 3</th>
325         </tr>
326         <tr>
327           <td>Cell 1</td>
328           <td>Cell 2</td>
329           <td>Cell 3</td>
330         </tr>
331         <tr>
332           <td>Cell 4</td>
333           <td>Cell 5</td>
334           <td>Cell 6</td>
335         </tr>
336       </tbody>
337     </table>
338   </td>
339 </tr>
340 <tr>
341   <td>[table border=1]</td>
342   <td>
343         <table border="1">
344       <tbody>
345         <tr>
346           <th>Header 1</th>
347           <th>Header 2</th>
348           <th>Header 3</th>
349         </tr>
350         <tr>
351           <td>Cell 1</td>
352           <td>Cell 2</td>
353           <td>Cell 3</td>
354         </tr>
355         <tr>
356           <td>Cell 4</td>
357           <td>Cell 5</td>
358           <td>Cell 6</td>
359         </tr>
360       </tbody>
361     </table>
362   </td>
363 </tr>
364 </table>
365
366 ### Lists
367
368 <table class="bbcodes">
369 <tr>
370   <th>BBCode</th>
371   <th>Result</th>
372 </tr>
373 <tr>
374   <td>[ul]<br>
375 &nbsp;&nbsp;[li] First list element<br>
376 &nbsp;&nbsp;[li] Second list element<br>
377 [/ul]<br>
378 [list]<br>
379 &nbsp;&nbsp;[*] First list element<br>
380 &nbsp;&nbsp;[*] Second list element<br>
381 [/list]</td>
382   <td>
383         <ul class="listbullet" style="list-style-type: circle;">
384                 <li>First list element</li>
385                 <li>Second list element</li>
386         </ul>
387   </td>
388 </tr>
389 <tr>
390   <td>[ol]<br>
391 &nbsp;&nbsp;[*] First list element<br>
392 &nbsp;&nbsp;[*] Second list element<br>
393 [/ol]<br>
394 [list=1]<br>
395 &nbsp;&nbsp;[*] First list element<br>
396 &nbsp;&nbsp;[*] Second list element<br>
397 [/list]</td>
398   <td>
399     <ul class="listdecimal" style="list-style-type: decimal;">
400       <li> First list element</li>
401       <li> Second list element</li>
402     </ul>
403   </td>
404 </tr>
405 <tr>
406   <td>[list=]<br>
407 &nbsp;&nbsp;[*] First list element<br>
408 &nbsp;&nbsp;[*] Second list element<br>
409 [/list]</td>
410   <td>
411     <ul class="listnone" style="list-style-type: none;">
412       <li> First list element</li>
413       <li> Second list element</li>
414     </ul>
415   </td>
416 </tr>
417 <tr>
418   <td>[list=i]<br>
419 &nbsp;&nbsp;[*] First list element<br>
420 &nbsp;&nbsp;[*] Second list element<br>
421 [/list]</td>
422   <td>
423     <ul class="listlowerroman" style="list-style-type: lower-roman;">
424       <li> First list element</li>
425       <li> Second list element</li>
426     </ul>
427   </td>
428 </tr>
429 <tr>
430   <td>[list=I]<br>
431 &nbsp;&nbsp;[*] First list element<br>
432 &nbsp;&nbsp;[*] Second list element<br>
433 [/list]</td>
434   <td>
435     <ul class="listupperroman" style="list-style-type: upper-roman;">
436       <li> First list element</li>
437       <li> Second list element</li>
438     </ul>
439   </td>
440 </tr>
441 <tr>
442   <td>[list=a]<br>
443 &nbsp;&nbsp;[*] First list element<br>
444 &nbsp;&nbsp;[*] Second list element<br>
445 [/list]</td>
446   <td>
447     <ul class="listloweralpha" style="list-style-type: lower-alpha;">
448       <li> First list element</li>
449       <li> Second list element</li>
450     </ul>
451   </td>
452 </tr>
453 <tr>
454   <td>[list=A]<br>
455 &nbsp;&nbsp;[*] First list element<br>
456 &nbsp;&nbsp;[*] Second list element<br>
457 [/list]</td>
458   <td>
459     <ul class="listupperalpha" style="list-style-type: upper-alpha;">
460       <li> First list element</li>
461       <li> Second list element</li>
462     </ul>
463   </td>
464 </tr>
465 </table>
466
467 ## Embed
468
469 You can embed video, audio and more in a message.
470
471 <table class="bbcodes">
472 <tr>
473   <th>BBCode</th>
474   <th>Result</th>
475 </tr>
476 <tr>
477   <td>[video]url[/video]</td>
478   <td>Where *url* can be an url to youtube, vimeo, soundcloud, or other sites wich supports oembed or opengraph specifications.</td>
479 </tr>
480 <tr>
481   <td>[video]Video file url[/video]
482 [audio]Audio file url[/audio]</td>
483   <td>Full URL to an ogg/ogv/oga/ogm/webm/mp4/mp3 file. An HTML5 player will be used to show it.</td>
484 </tr>
485 <tr>
486   <td>[youtube]Youtube URL[/youtube]</td>
487   <td>Youtube video OEmbed display. May not embed an actual player.</td>
488 </tr>
489 <tr>
490   <td>[youtube]Youtube video ID[/youtube]</td>
491   <td>Youtube player iframe embed.</td>
492 </tr>
493 <tr>
494   <td>[vimeo]Vimeo URL[/vimeo]</td>
495   <td>Vimeo video OEmbed display. May not embed an actual player.</td>
496 </tr>
497 <tr>
498   <td>[vimeo]Vimeo video ID[/vimeo]</td>
499   <td>Vimeo player iframe embed.</td>
500 </tr>
501 <tr>
502   <td>[embed]URL[/embed]</td>
503   <td>Embed OEmbed rich content.</td>
504 </tr>
505 <tr>
506   <td>[iframe]URL[/iframe]</td>
507   <td>General embed, iframe size is limited by the theme size for video players.</td>
508 </tr>
509 <tr>
510   <td>[url]*url*[/url]</td>
511   <td>If *url* supports oembed or opengraph specifications the embedded object will be shown (eg, documents from scribd).
512 Page title with a link to *url* will be shown.</td>
513 </tr>
514 </table>
515
516 ## Map
517
518 This requires "openstreetmap" or "Google Maps" addon version 1.3 or newer.
519 If the addon isn't activated, the raw coordinates are shown instead.
520
521 <table class="bbcodes">
522 <tr>
523   <th>BBCode</th>
524   <th>Result</th>
525 </tr>
526 <tr>
527   <td>[map]address[/map]</td>
528   <td>Embeds a map centered on this address.</td>
529 </tr>
530 <tr>
531   <td>[map=lat,long]</td>
532   <td>Embeds a map centered on those coordinates.</td>
533 </tr>
534 <tr>
535   <td>[map]</td>
536   <td>Embeds a map centered on the post's location.</td>
537 </tr>
538 </table>
539
540 ## Abstract for longer posts
541
542 If you want to spread your post to several third party networks you may have the problem that these networks have a length limitation like on Twitter.
543
544 Friendica uses a semi-intelligent mechanism to generate a fitting abstract.
545 But it can be useful to define a custom abstract that will only be displayed on the external network.
546 This is done with the [abstract]-element.
547 <table class="bbcodes">
548 <tr>
549   <th>BBCode</th>
550   <th>Result</th>
551 </tr>
552 <tr>
553   <td>[abstract]Totally interesting! A must-see! Please click the link![/abstract]<br>
554 I want to tell you a really boring story that you really never wanted to hear.</td>
555   <td>Twitter would display the text <blockquote>Totally interesting! A must-see! Please click the link!</blockquote>
556 On Friendica you would only see the text after <blockquote>I want to tell you a really ...</blockquote></td>
557 </tr>
558 </table>
559
560 It is even possible to define abstracts for separate networks:
561
562 <table class="bbcodes">
563 <tr>
564   <th>BBCode</th>
565   <th>Result</th>
566 </tr>
567 <tr>
568   <td>
569 [abstract]Hi friends Here are my newest pictures![/abstract]<br>
570 [abstract=twit]Hi my dear Twitter followers. Do you want to see my new
571 pictures?[/abstract]<br>
572 [abstract=apdn]Helly my dear followers on ADN. I made sone new pictures
573 that I wanted to share with you.[/abstract]<br>
574 Today I was in the woods and took some real cool pictures ...</td>
575   <td>For Twitter and App.net the system will use the defined abstracts.<br>
576 For other networks (e.g. when you are using the "statusnet" connector that is used to post to your GNU Social account) the general abstract element will be used.</td>
577 </tr>
578 </table>
579
580 If you use (for example) the "buffer" connector to post to Facebook or Google+ you can use this element to define an abstract for a longer blogpost that you don't want to post completely to these networks.
581
582 Networks like Facebook or Google+ aren't length limited.
583 For this reason the [abstract] element isn't used.
584 Instead you have to name the explicit network:
585
586 <table class="bbcodes">
587 <tr>
588   <th>BBCode</th>
589   <th>Result</th>
590 </tr>
591 <tr>
592   <td>
593 [abstract]These days I had a strange encounter...[/abstract]<br>
594 [abstract=goog]Hello my dear Google+ followers. You have to read my newest blog post![/abstract]<br>
595 [abstract=face]Hello my Facebook friends. These days happened something really cool.[/abstract]<br>
596 While taking pictures in the woods I had a really strange encounter...</td>
597   <td>Google and Facebook will show the respective abstracts while the other networks will show the default one.<br>
598 <br>Meanwhile, Friendica won't show any of the abstracts.</td>
599 </tr>
600 </table>
601
602 The [abstract] element is not working with connectors where we post HTML directly, like Tumblr, Wordpress or Pump.io.
603 For the native connections--that is to e.g. Friendica, Hubzilla, Diaspora or GNU Social--the full posting is used and the contacts instance will display the posting as desired.
604
605 ## Special
606
607 <table class="bbcodes">
608 <tr>
609   <th>BBCode</th>
610   <th>Result</th>
611 </tr>
612 <tr>
613   <td>If you need to put literal bbcode in a message, [noparse], [nobb] or [pre] are used to escape bbcode:
614     <ul>
615       <li>[noparse][b]bold[/b][/noparse]</li>
616       <li>[nobb][b]bold[/b][/nobb]</li>
617       <li>[pre][b]bold[/b][/pre]</li>
618     </ul>
619   </td>
620   <td>[b]bold[/b]</td>
621 </tr>
622 <tr>
623   <td>[nosmile] is used to disable smilies on a post by post basis<br>
624     <br>
625     [nosmile] ;-) :-O
626   </td>
627   <td>;-) :-O</td>
628 </tr>
629 <tr>
630   <td>Custom inline styles<br>
631 <br>
632 [style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style]</td>
633   <td><span style="text-shadow: 0 0 4px #cc0000;;">You can change all the CSS properties of this block.</span></td>
634 </tr>
635 <tr>
636   <td>Custom class block<br>
637 <br>
638 [class=custom]If the class exists, this block will have the custom class style applied.[/class]</td>
639   <td><pre>&lt;span class="custom"&gt;If the class exists,<br> this block will have the custom class<br> style applied.&lt;/span&gt;</pre></td>
640 </tr>
641 </table>