Markdown

par Édouard Lopez

atelier CLI – 17 mars 2015

cc-by-sa-nc

Usages

  • Formater rapidement et simplement pour le web (liste, images) ;
     
  • Rédiger de la doc, des blogs ;
     
  • Facilement transformable/dérivable (cf. Pandoc)
     
  • document.md

 

  • Attention: moyennement structuré (≠JSON ni XML)

 

Histoire

  • 2004: création
    • John Gruber +  Aaron Swartz (RSS, JStore)
    • script Perl: markdown →(X)HTML
  • 2012-2104: processus de standardisation
    • Jeff Atwood (blog Coding Horror)
    • lister les outils et les implémentations
    • Markdown → CommonMark (nobody gives a f*ck!)
    • IETF: Internet media type text/markdown (~ classification, rendu de contenu)
  • + en + répandu
    • Github, StackOverflow, Reddit, OSM, SourceForge, etc.

Principes

  • Intuitif: inspiré des conventions et pratiques mail existantes.
     
  • Lisible: même sous sa forme brute

Syntaxe

Intro rapide sur Github.

 

  • Texte
  • Liste ordonnées
  • Liste non-ordonnées
  • Images
  • En-têtes
  • Citation
  • Code
    • avec GFM/gitlab
    • colorisé
  • HTML

 

 

N.B. : Il peut existé plusieurs formes, mais je ne présente que la plus intuitif et les plus courantes.

Texte

It's very easy to make some words **bold** and other words _italic_ with Markdown.

You can even [link to Google!](http://google.com)

Liste ordonnées

Sometimes you want numbered lists:

1. One
2. Two
3. Three
  1. Sous-liste

 

N.B. : utilisé des sauts de lignes pour distinguer les blocs.

Liste non-ordonnées

Sometimes you want bullet points:

* Start a line with a star
  * sous-liste indentation de 2 espaces
* Profit!

Images

If you want to embed images, this is how you do it:

![Image de poulpe](https://example.com/poulpe.png)

En-têtes

# Structured documents

Sometimes it's useful to have different levels of headings to structure your documents. Start lines with a `#` to create headings. Multiple `##` in a row denote smaller heading sizes.

### This is a third-tier heading

You can use  one `#` all the way up to `######` six for different heading sizes.

Citation

If you'd like to quote someone, use the > character before the line:

> Coffee. The finest organic suspension ever devised... I beat the Borg with it.
> - Captain Janeway

Code

Indentez avec 4 espaces:

 

    if (isAwesome){
      return true
    }

 

Code avec GFM/gitlab

GFM ou Github Flavour Markdown utilise 3 backtick

 

```
if (isAwesome){
  return true
}
```

Code Colorisé

Support de la coloration syntaxique

 

```javascript
if (isAwesome){
  return true
}
```

HTML

Besoin d'allez plus loin ?

Il est possible d'intégrer du HTML au milieu de votre MarkDown!

 

# Markdown Header with <b>HTML</b>

This is an <abbr title="HyperText Markup Language">HTML</abbr> abbreviation in the middle of a MarkDown paragraph.

 

Extensions

  • tables,
  • footnotes,
  • definition lists

Références

* [MarkDown](https://en.wikipedia.org/wiki/Markdown)
* [CommonMark](http://commonmark.org/)
* [CommonMark Spec](http://spec.commonmark.org/)

Q&A

  • Twitter: @edouard_lopez
     
  • Mail: contact+cli@edouard-lopez.com
     
  • Github: edouard-lopez
Made with Slides.com