Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
docs:bbcode [2022-06-08 13:41] – [Titles] Tobiasdocs:bbcode [2022-06-09 08:51] (current) – [Blocks] Tobias
Line 55: Line 55:
 ==== Blocks ==== ==== Blocks ====
  
-<table class="bbcodes"> +=== Paragraphs ===
-<tr> +
-  <th>BBCode</th> +
-  <th>Result</th> +
-</tr> +
-<tr> +
-  <td>[p]A paragraph of text[/p]</td> +
-  <td><p>A paragraph of text</p></td> +
-</tr> +
-<tr> +
-  <td>Inline [code]code[/code] in a paragraph</td> +
-  <td>Inline <key>code</key> in a paragraph</td> +
-</tr> +
-<tr> +
-  <td>[code]Multi<br>line<br>code[/code]</td> +
-  <td><code>Multi +
-line +
-code</code></td> +
-</tr> +
-<tr> +
-  <td>[code=php]function text_highlight($s,$lang)[/code]<sup><a href="#supported-code">1</a></sup></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">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> +
-</tr> +
-<tr> +
-  <td>[quote]quote[/quote]</td> +
-  <td><blockquote>quote</blockquote></td> +
-</tr> +
-<tr> +
-  <td>[quote=Author]Author? Me? No, no, no...[/quote]</td> +
-  <td><strong class="author">Author wrote:</strong><blockquote>Author? Me? No, no, no...</blockquote></td> +
-</tr> +
-<tr> +
-  <td>[center]Centered text[/center]</td> +
-  <td><div style="text-align:center;">Centered text</div></td> +
-</tr> +
-<tr> +
-  <td>You should not read any further if you want to be surprised.[spoiler]There is a happy end.[/spoiler]</td> +
-  <td> +
-    <div class="wall-item-container"> +
-      You should not read any further if you want to be surprised.<br> +
-      <span id="spoiler-wrap-0716e642" class="spoiler-wrap fakelink" onclick="openClose('spoiler-0716e642');">Click to open/close</span> +
-      <blockquote class="spoiler" id="spoiler-0716e642" style="display: none;">There is a happy end.</blockquote> +
-      <div class="body-attach"><div class="clear"></div></div> +
-    </div> +
-  </td> +
-</tr> +
-<tr> +
-  <td>[spoiler=Author]Spoiler quote[/spoiler]</td> +
-  <td> +
-    <div class="wall-item-container"> +
-      <strong class="spoiler">Author wrote:</strong><br> +
-      <span id="spoiler-wrap-a893765a" class="spoiler-wrap fakelink" onclick="openClose('spoiler-a893765a');">Click to open/close</span> +
-      <blockquote class="spoiler" id="spoiler-a893765a" style="display: none;">Spoiler quote</blockquote> +
-      <div class="body-attach"><div class="clear"></div></div> +
-    </div> +
-  </td> +
-</tr> +
-<tr> +
-  <td>[hr] (horizontal line)</td> +
-  <td><hr></td> +
-</tr> +
-</table>+
  
-<name="supported-code">1</a>: Supported language parameter values for code highlighting+Usually, when you hit the ''ENTER'' key on your keyboard, Friendica will insert line break in the display to reflect it. However if you wish to separate a new paragraph, you can also use the ''[p]'' BBCode tag, accompanied with a ''[/p]'' at the end of the paragraph. 
-- abap + 
-- avrc +=== Centered Text === 
-- cpp + 
-- css +In Friendica you can center a text using the ''[center]This text is centered[/center]'' BBCode tag. 
-- diff + 
-- dtd +=== Code Blocks === 
-- html + 
-- java +You can either use inline code or create a multi-line code block, both by using the BBCode ''[code]'' tag. If it is used on a single line surrounding your code (maybe even embedded within the text you are writing) the code will be displayed inline. 
-- javascript + 
-- js +However if you put more then one line of code in the ''[code]'' tag, it will be visually separated from the rest of the code. In addition, on a multi-line code block you can specify the programming language used in the following code block. If the nodes admin has activated the [[https://git.friendi.ca/friendica/friendica-addons/src/branch/develop/highlightjs|hightlightjs addon]] this information will be used to apply the correct syntax highlighting. You can find a list of the supported programming languages on [[https://highlightjs.org/static/demo/|the used libraries homepage]]. 
-- mysql + 
-- perl +For example 
-- php + 
-- python +<code> 
-- ruby +Can somebody help me with the [code]hello_world()[/code] function in the [code]indroduction[/code] module? 
-- sh +</code> 
-- sql + 
-- vbscript +will produce posting like 
-xml+ 
 +Can somebody help me with the ''hello_world()'' function in the ''indroduction'' module? 
 + 
 +while something like 
 + 
 +<code> 
 +Can somebody help me understand the following function from the [code]introduction[/code] module? 
 + 
 +[code=python] 
 +def hello_world(): 
 +  """ 
 +  A function to print "Hello World!" to the terminal. 
 +  """ 
 +  print('Hello World!'
 +[/code
 +</code> 
 + 
 +will produce something like 
 + 
 +> Can somebody help me understand the following function from the ''introduction'' module? 
 +
 +> <code=python> 
 +def hello_world()
 +  """ 
 +  A function to print "Hello World!" to the terminal. 
 +  """ 
 +  print('Hello World!') 
 +</code> 
 + 
 +=== Quotes === 
 + 
 +To quote a text, you can use the ''[quote]'' tag within your posting. 
 + 
 +<code> 
 +Hey I found this wonderful quote from Albert Einstein 
 +[quote=Albert Einstein] 
 +Everybody is a genius, but if you judge a fish by its ability to climb a tree, it will live its hole life believing it is stupid. 
 +[/quote] 
 +I can fully agree with it! 
 +</code> 
 + 
 +the posting will look something like this 
 + 
 +{{ :docs:bbcode_quote_alberteinstein.png?nolink |}} 
 + 
 +If you don't provide the ''=Author'' information in the opening ''[quote]'' tag, Friendica wont display the line //Author wrote://. 
 + 
 +=== Spoilers === 
 + 
 +Sometimes you may want to warn your readers, that they should avoid reading any further if they wont get spoiled. In Friendica you can use the ''[spoiler]'' tag to do so. This will hide the included text behind the warning you issue, your Friendica contacts will have to click on the waring to read the hidden text. 
 + 
 +<code> 
 +So the other day we were at the cinema watching this awesome movie ... it don't want to spoil too much you should go see it for yourself. For those not caring about spoilers, you can find my review below. 
 + 
 +[spoiler=Don't read any further if you don't want to know any details before watching the move]Ok, I told you about the spoilers incoming, last chance ;-
 + 
 +So the most awesome... 
 +[/spoiler] 
 + 
 +After the movie we had lunch at the Funny Milkbar which... 
 +</code> 
 + 
 +The result can be seen in the following screenshots. On the first the text inside the spoiler tag is hidden. I 
 + 
 +{{  :docs:bbcode_spoiler1.png?nolink  |Only the text surrounding the spoiler is shown, and the spoilers warning.}} 
 + 
 +In the second it is shown after the reader had clicked on the spoiler text. 
 + 
 +{{  :docs:bbcode_spoiler2.png?nolink  |After clicking on the spoiler warning, your Friendica contacts will the the text inside the spoiler tag}} 
 + 
 +=== Horizontal Lines === 
 + 
 +If you want to use a horizontal line as visual divider between two paragraphs, you can use the ''[hr]'' BBCode tag. Even used in the middle of a text, it will insert a horizontal line of the postings width as separation between the text.
  
 ==== Titles ==== ==== Titles ====
  • Last modified: 2022-06-09 08:51