1
0
Fork 0
friendica_2020-09-1_sharedH.../doc/BBCode.md
Hypolite Petovan faeffff8a3 [pre] blocks now preserve spaces
- Added test case
- Added English documentation
2020-06-23 07:53:18 -04:00

18 KiB

Friendica BBCode tags reference

Inline

BBCode Result
[b]bold[/b] bold
[i]italic[/i] italic
[u]underlined[/u] underlined
[s]strike[/s] strike
[o]overline[/o] overline
[color=red]red[/color] red
[url=http://friendi.ca]Friendica[/url] Friendica
[img]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img] Immagine/foto
[img=https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg]The Friendica Logo[/img] The Friendica Logo
[img=64x32]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]

Note: provided height is simply discarded.
[size=xx-small]small text[/size] small text
[size=xx-large]big text[/size] big text
[size=20]exact size[/size] (size can be any number, in pixels) exact size
[font=serif]Serif font[/font] Serif font
BBCode Result
[url]http://friendi.ca[/url] http://friendi.ca
[url=http://friendi.ca]Friendica[/url] Friendica
[bookmark]http://friendi.ca[/bookmark]

#^[url]http://friendi.ca[/url]

Friendica: http://friendi.ca

[bookmark=http://friendi.ca]Bookmark[/bookmark]

#^[url=http://friendi.ca]Bookmark[/url]

#[url=http://friendi.ca]^[/url][url=http://friendi.ca]Bookmark[/url]

Friendica: Bookmark

[url=/posts/f16d77b0630f0134740c0cc47a0ea02a]Diaspora post with GUID[/url] Diaspora post with GUID
#Friendica #Friendica
@Mention @Mention
acct:account@friendica.host.com (WebFinger) acct:account@friendica.host.com
[mail]user@mail.example.com[/mail] user@mail.example.com
[mail=user@mail.example.com]Send an email to User[/mail] Send an email to User

Blocks

BBCode Result
[p]A paragraph of text[/p]

A paragraph of text

Inline [code]code[/code] in a paragraph Inline code in a paragraph
[code]Multi
line
code[/code]
Multi line code
[code=php]function text_highlight($s,$lang)[/code]1
  1.  function text_highlight($s,$lang)
[quote]quote[/quote]
quote
[quote=Author]Author? Me? No, no, no...[/quote] Author wrote:
Author? Me? No, no, no...
[center]Centered text[/center]
Centered text
You should not read any further if you want to be surprised.[spoiler]There is a happy end.[/spoiler]
You should not read any further if you want to be surprised.
Click to open/close
There is a happy end.
[spoiler=Author]Spoiler quote[/spoiler]
Author wrote:
Click to open/close
Spoiler quote
[hr] (horizontal line)

1: Supported language parameter values for code highlighting:

  • abap
  • avrc
  • cpp
  • css
  • diff
  • dtd
  • html
  • java
  • javascript
  • js
  • mysql
  • perl
  • php
  • python
  • ruby
  • sh
  • sql
  • vbscript
  • xml

Titles

BBCode Result
[h1]Title 1[/h1]

Title 1

[h2]Title 2[/h2]

Title 2

[h3]Title 3[/h3]

Title 3

[h4]Title 4[/h4]

Title 4

[h5]Title 5[/h5]
Title 5
[h6]Title 6[/h6]
Title 6

Tables

BBCode Result
[table]
  [tr]
    [th]Header 1[/th]
    [th]Header 2[/th]
    [th]Header 2[/th]
  [/tr]
  [tr]
    [td]Cell 1[/td]
    [td]Cell 2[/td]
    [td]Cell 3[/td]
  [/tr]
  [tr]
    [td]Cell 4[/td]
    [td]Cell 5[/td]
    [td]Cell 6[/td]
  [/tr]
[/table]
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
[table border=0]
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6
[table border=1]
Header 1 Header 2 Header 3
Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6

Lists

BBCode Result
[ul]
  [li] First list element
  [li] Second list element
[/ul]
[list]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element
[ol]
  [*] First list element
  [*] Second list element
[/ol]
[list=1]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element
[list=]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element
[list=i]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element
[list=I]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element
[list=a]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element
[list=A]
  [*] First list element
  [*] Second list element
[/list]
  • First list element
  • Second list element

Embed

You can embed video, audio and more in a message.

BBCode Result
[video]url[/video] Where *url* can be an url to youtube, vimeo, soundcloud, or other sites wich supports oembed or opengraph specifications.
[video]Video file url[/video] [audio]Audio file url[/audio] Full URL to an ogg/ogv/oga/ogm/webm/mp4/mp3 file. An HTML5 player will be used to show it.
[youtube]Youtube URL[/youtube] Youtube video OEmbed display. May not embed an actual player.
[youtube]Youtube video ID[/youtube] Youtube player iframe embed.
[vimeo]Vimeo URL[/vimeo] Vimeo video OEmbed display. May not embed an actual player.
[vimeo]Vimeo video ID[/vimeo] Vimeo player iframe embed.
[embed]URL[/embed] Embed OEmbed rich content.
[iframe]URL[/iframe] General embed, iframe size is limited by the theme size for video players.
[url]*url*[/url] If *url* supports oembed or opengraph specifications the embedded object will be shown (eg, documents from scribd). Page title with a link to *url* will be shown.

Map

This requires "openstreetmap" or "Google Maps" addon version 1.3 or newer. If the addon isn't activated, the raw coordinates are shown instead.

BBCode Result
[map]address[/map] Embeds a map centered on this address.
[map=lat,long] Embeds a map centered on those coordinates.
[map] Embeds a map centered on the post's location.

Abstract for longer posts

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.

Friendica uses a semi-intelligent mechanism to generate a fitting abstract. But it can be useful to define a custom abstract that will only be displayed on the external network. This is done with the [abstract]-element.

BBCode Result
[abstract]Totally interesting! A must-see! Please click the link![/abstract]
I want to tell you a really boring story that you really never wanted to hear.
Twitter would display the text
Totally interesting! A must-see! Please click the link!
On Friendica you would only see the text after
I want to tell you a really ...

It is even possible to define abstracts for separate networks:

BBCode Result
[abstract]Hi friends Here are my newest pictures![/abstract]
[abstract=twit]Hi my dear Twitter followers. Do you want to see my new pictures?[/abstract]
[abstract=apdn]Helly my dear followers on ADN. I made sone new pictures that I wanted to share with you.[/abstract]
Today I was in the woods and took some real cool pictures ...
For Twitter and App.net the system will use the defined abstracts.
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.

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.

Networks like Facebook or Google+ aren't length limited. For this reason the [abstract] element isn't used. Instead you have to name the explicit network:

BBCode Result
[abstract]These days I had a strange encounter...[/abstract]
[abstract=goog]Hello my dear Google+ followers. You have to read my newest blog post![/abstract]
[abstract=face]Hello my Facebook friends. These days happened something really cool.[/abstract]
While taking pictures in the woods I had a really strange encounter...
Google and Facebook will show the respective abstracts while the other networks will show the default one.

Meanwhile, Friendica won't show any of the abstracts.

The [abstract] element is not working with connectors where we post HTML directly, like Tumblr, Wordpress or Pump.io. 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.

For postings that are delivered via ActivityPub, the text from the abstract is placed in the summary field. On Mastodon this field is used for the content warning.

Special

BBCode Result
If you need to put literal BBCode in a message, [noparse], [nobb] or [pre] blocks prevent BBCode conversion:
  • [noparse][b]bold[/b][/noparse]
  • [nobb][b]bold[/b][/nobb]
  • [pre][b]bold[/b][/pre]
Note: [code] has priority over [noparse], [nobb] and [pre] which makes them display as BBCode tags in code blocks instead of being removed. [code] blocks inside [noparse] will still be converted to a code block.
[b]bold[/b]
Additionally, [noparse] and [pre] blocks prevent mention and hashtag conversion to links:
  • [noparse]@user@domain.tld #hashtag[/noparse]
  • [pre]@user@domain.tld #hashtag[/pre]
@user@domain.tld #hashtag
Additionally, [pre] blocks preserve spaces:
  • [pre]      Spaces[/pre]
      Spaces
[nosmile] is used to disable smilies on a post by post basis

[nosmile] ;-) :-O
;-) :-O
Custom inline styles

[style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style]
You can change all the CSS properties of this block.
Custom class block

[class=custom]If the class exists, this block will have the custom class style applied.[/class]
<span class="custom">If the class exists,
this block will have the custom class
style applied.</span>