86 lines
4.3 KiB
Markdown
86 lines
4.3 KiB
Markdown
|
---
|
|||
|
Title: Écrire son courriel en markdown avec vim
|
|||
|
Date: 2019-04-22 19:00
|
|||
|
Modified: 2019-04-24 09:35
|
|||
|
Author: Fabrice
|
|||
|
Category: Astuces
|
|||
|
Tags: emails, pandoc, Vim
|
|||
|
Slug: vim-md-emails
|
|||
|
Header_Cover: ../images/covers/amsterdam.jpg
|
|||
|
Summary: Un exemple d'utilisation combinée de vim et d'autres outils pour utiliser facilement des modèles d'e-mails en markdown.
|
|||
|
Lang: fr
|
|||
|
---
|
|||
|
|
|||
|
Si comme moi vous n’aimez pas passer du temps dans des éditeurs <abbr title="What You See Is What You Get">WYSIWYG</abbr> pour formater vos textes, vous serez possiblement intéressés par cette petite astuce.
|
|||
|
|
|||
|
Malgré ça, j'utilise quand même [thunderbird](https://www.thunderbird.net/) comme client mail sur mon ordinateur.
|
|||
|
Et on peut remarquer que lorsqu’on copie-colle depuis une page web (par exemple depuis [firefox](https://www.mozilla.org/fr/firefox/), le style de texte est aussi copié (ce qui peut parfois causer des incohérences dans le style de texte sans que ce soit visible à l'édition, mais c'est un autre problème).
|
|||
|
En utilisant cette remarque, on peut directement exporter de l'html dans le presse-papier et le coller dans thunderbird pour avoir le formatage désiré.
|
|||
|
|
|||
|
Pour ce faire, c'est aussi simple que ça:
|
|||
|
```sh
|
|||
|
pandoc -t html5 -s <fichier> | xclip -selection clipboard
|
|||
|
```
|
|||
|
|
|||
|
Ainsi, en ajoutant ce raccourcis dans votre fichier de configuration pour les markdown dans vim (pour ma part il est dans `ftplugin/pandoc.vim`):
|
|||
|
```vim
|
|||
|
map <raccourcis> :w !pandoc -t html5 -s \| xclip -selection clipboard<cr>
|
|||
|
```
|
|||
|
on peut alors directement coller le contenu du *buffer* courant formatée par [pandoc](https://pandoc.org/) dans thunderbird.
|
|||
|
Bien entendu, vous pouvez décorer cette commande à l'aide de vos options favorites.
|
|||
|
Par exemple, j'utilise `--base-header-level=4` puisque dans mes emails je n’utilise que rarement le premier niveau de titre.
|
|||
|
Pour aller encore plus loin, il est possible de rajouter une feuille de style [simple](https://perfectmotherfuckingwebsite.com/) pour améliorer un poil plus la présentation, par exemple pour des [infolettres](https://fr.wikipedia.org/wiki/Lettre_d%27information).
|
|||
|
|
|||
|
**Note:** j'utilise les plugins vim [vim-pandoc](https://github.com/vim-pandoc/vim-pandoc) et [vim-pandoc-syntax](https://github.com/vim-pandoc/vim-pandoc-syntax).
|
|||
|
|
|||
|
Un exemple de modèle de lettres préformatés et facilement modifiables: un e-mail RGPD directement inspiré de celui d’[aeris'](https://gist.github.com/aeris/675ffd5755f7570469448bb8b890f759).
|
|||
|
```md
|
|||
|
Dear Sir or Madam,
|
|||
|
|
|||
|
My personal data, such as my e-mail address, are protected under the
|
|||
|
GDPR law since May 2016:\
|
|||
|
<https://www.privacy-regulation.eu/en/>
|
|||
|
|
|||
|
As per article 3, all GDPR applies to you as I am an EU citizen, even
|
|||
|
if you are outside EU:\
|
|||
|
<https://www.privacy-regulation.eu/en/3.htm>
|
|||
|
|
|||
|
As per article 15, I request you to provide me all personal data you
|
|||
|
have about myself, the purpose of the processing, why and **how** you
|
|||
|
collect them, if you share my data with others people or countries,
|
|||
|
and all other informations that are mentioned in the following:\
|
|||
|
<https://www.privacy-regulation.eu/en/15.htm>
|
|||
|
|
|||
|
As per article 7, I request you to **prove** my **explicit** and
|
|||
|
**positive** consent fr my personnal data to be collected and
|
|||
|
processed:\
|
|||
|
<https://www.privacy-regulation.eu/en/7.htm>
|
|||
|
|
|||
|
As per article 17, I also request all my personal data to be erased
|
|||
|
from your databases (including backups), with a proof of erasure,
|
|||
|
**but only once you provided me with all the aforementioned
|
|||
|
information**:\
|
|||
|
<https://www.privacy-regulation.eu/en/17.htm>
|
|||
|
|
|||
|
As per article 12, these requests have to be fulfilled within **a
|
|||
|
month** from Today (April 4th 2019). Should this not be the case,
|
|||
|
I will open a case with EU regulator:\
|
|||
|
<https://www.privacy-regulation.eu/en/12.htm>
|
|||
|
|
|||
|
As per article 19, I have the same request to **all your partners** to
|
|||
|
whom my personal data have been transfered to. These have to be
|
|||
|
accompanied by an attestation of erasure from these partners as
|
|||
|
well:\
|
|||
|
<https://www.privacy-regulation.eu/en/19.htm>
|
|||
|
|
|||
|
This e-mail is signed under the GPG key
|
|||
|
[`0x2C5033B228CFE4E7`](https://fmouhart.epheme.re/documents/pubkey.asc)
|
|||
|
that also appears in the above website, which suffices to prove my
|
|||
|
identity as the rightful owner of these personal data.
|
|||
|
|
|||
|
If you require further information to fulfill my requests, feel free
|
|||
|
to contact me on this e-mail address.
|
|||
|
|
|||
|
Sincerely yours,
|
|||
|
```
|