Markdown on the FI website
Markdown in general
Markdown is a markup language, similar to HTML. However, its syntax is much simpler, although it has fewer functional options. On the FI Web, it can be used to edit simple pages with mostly text content.
Syntax
Markdown does not have an official standard, so you may encounter different dialects of the language and the options it offers on the Internet. However, most of them have the same basis, see for example
The faculty website wiki uses the module
Text::Markdown::Discount
that implements the
Discount Markdown dialect. The following paragraph describes some of the special features of this module.
Extensions for Discount Markdown
Paragraph Alignment
zarovnání vlevo
->zarovnání na střed<-
left alignment
center alignment
Resize image
![potoo](/files/cvtadm/zam-960-452.jpg =250x110)
![potoo](/files/cvtadm/zam-960-452.jpg =125x55)
Definition lists
=html=
značkovací jazyk pro tvorbu webových stránek
=markdown=
značkovací jazyk pro tvorbu dokumentů
- html
- a markup language for creating web pages
- markdown
- markup language for creating documents
Lists with letters
a. první bod
b. druhý bod
- first point
- second point
Special classes
zkratky: [NLP](abbr:Natural Language Processing)
třídy stylu: [červený text](class:red)
kotva: [](id:kotva)
výstup bez formátování: [](raw:tohle **není** markdown)
NLP
red text
the mark cannot be seen in the text
this is **not** markdown
Class block
> %red%
> Celý tento blok
> bude červený
Tables
produkt | počet
--------|------
počítač | 7
monitor | 3
Product | Number of |
---|---|
computer | 7 |
monitor | 3 |
Code snippets
```perl
#!/usr/bin/perl
use common::sense;
say "Hello, $0";
```
#!/usr/bin/perl
use common::sense;
say "Hello, $0";
How to enable Markdown in the wiki
Create a blank page
Follow the same steps as for an HTML5 page.Switch the input format to Markdown
In the Input Format section of the page header, select Markdown instead of the default HTML5 option.
Delete the template
The template for newly created pages is for the HTML5 format and may not work the same way for Markdown.Done
You can now create a page in Markdown format. As for HTML5, you can use Preview to quickly view the page.
HTML tags in Markdown
Discount Markdown also allows you to use pure HTML in the text of a page, including the graphical components of the Unified Visual Style and faculty tags. However, we recommend using these components rarely or not at all, as the full functionality of all tags is not guaranteed. In addition, the goal of using Markdown is to avoid writing HTML.
General guidelines for using HTML in Markdown:
- write the first HTML tag on the left, it must not be indented.
- the first HTML tag should be on the line itself, do not add a closing tag on the same line
- do not use Markdown formatting inside tags
- HTML code must be correct, the same rules apply as for HTML5 pages
- if something doesn't work (you get validation errors), try wrapping the whole block in
<div>
Example of correct HTML in Markdown:
Toto je odstavec **Markdown** s _formátováním_.
<fi-email to="john.doe@example.com">
John <em>Doe</em>
</fi-email>
Po ukončení HTML značky lze opět psát
**Markdown** s _formátováním_.
This is a Markdown paragraph with formatting.
John Doe
After the HTML markup is complete, you can write Markdown with formatting again.
An example of incorrect HTML in Markdown:
Uvnitř HTML značek nelze používat Markdown formátování:
<div>
Tento text se **nezobrazí** _správně_.
</div>
You cannot use Markdown formatting inside HTML tags:
První HTML značka nesmí být uzavřena na stejném řádku:
<fi-row>Text.</fi-row>
Přepište kód na více řádků:
<fi-row>
Text.
</fi-row>
Validation error:
[parser:must:163] stray end tag, value='fi-row'
Pokud nějaký text v Markdown odsadíte, zpracuje
se jako neformátovaný text:
int main(void)
{
return EXIT_SUCCESS;
}
Stejně pokud vložíte HTML kód do stránky
s odsazením, dostanete stejný, pravděpodobně
nežádaný výsledek:
<fi-email to="john.doe@example.com"></fi-email>
If you indent some text in Markdown, it is treated as unformatted text:
int main(void) { return EXIT_SUCCESS; }
Similarly, if you insert HTML code into a page with indentation, you get the same, probably unwanted result:
<fi-email to="john.doe@example.com"/>