informatique:outils:vim:convertir_en_html
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| informatique:outils:vim:convertir_en_html [2025/01/02 09:25] – supprimée - modification externe (Date inconnue) 127.0.0.1 | informatique:outils:vim:convertir_en_html [2025/01/02 09:25] (Version actuelle) – ↷ Page déplacée de informatique:vim:convertir_en_html à informatique:outils:vim:convertir_en_html alexis | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Convertir en HTML ====== | ||
| + | |||
| + | Il est possible de convertir le contenu d'un fichier en HTML en utilisant '' | ||
| + | Il est possible de le faire également en mode CLI de la manière suivante : | ||
| + | <WRAP prewrap> | ||
| + | <code bash> | ||
| + | # Convertir tout le fichier | ||
| + | vim -e < | ||
| + | |||
| + | # Convertir une partie du fichier (de la ligne 10 à la ligne 20 incluse) | ||
| + | vim -e < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Avec l' | ||
| + | <WRAP prewrap> | ||
| + | <code bash> | ||
| + | # Avec un arrière plan foncé | ||
| + | vim -e < | ||
| + | |||
| + | # Avec un arrière plan clair | ||
| + | vim -e < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <WRAP tip> | ||
| + | Il est intéressant de pouvoir convertir le fichier HTML généré en image pour pouvoir l' | ||
| + | </ | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | ==== Fichier source ==== | ||
| + | <WRAP prewrap> | ||
| + | <code python event.py> | ||
| + | class Card: | ||
| + | def __init__(self, | ||
| + | self.event=event | ||
| + | self.person=person | ||
| + | |||
| + | def message(self): | ||
| + | print(f" | ||
| + | |||
| + | card = Card(' | ||
| + | card.message() | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <WRAP group> | ||
| + | <WRAP half column> | ||
| + | |||
| + | ==== Résultat avec le thème sombre ==== | ||
| + | <WRAP prewrap> | ||
| + | <code html event.py.dark.html> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <meta charset=" | ||
| + | < | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | <!-- | ||
| + | pre { white-space: | ||
| + | body { font-family: | ||
| + | * { font-size: 1em; } | ||
| + | .LineNr { color: #ffff00; } | ||
| + | .Constant { color: #ff40ff; } | ||
| + | .Identifier { color: #00ffff; font-weight: | ||
| + | .Statement { color: #ffff00; } | ||
| + | --> | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <!-- | ||
| + | |||
| + | /* function to open any folds containing a jumped-to line before jumping to it */ | ||
| + | function JumpToLine() | ||
| + | { | ||
| + | var lineNum; | ||
| + | lineNum = window.location.hash; | ||
| + | lineNum = lineNum.substr(1); | ||
| + | |||
| + | if (lineNum.indexOf(' | ||
| + | lineNum = ' | ||
| + | } | ||
| + | var lineElem = document.getElementById(lineNum); | ||
| + | /* Always jump to new location even if the line was hidden inside a fold, or | ||
| + | * we corrected the raw number to a line ID. | ||
| + | */ | ||
| + | if (lineElem) { | ||
| + | lineElem.scrollIntoView(true); | ||
| + | } | ||
| + | return true; | ||
| + | } | ||
| + | if (' | ||
| + | window.onhashchange = JumpToLine; | ||
| + | } | ||
| + | |||
| + | --> | ||
| + | </ | ||
| + | </ | ||
| + | <body onload=' | ||
| + | <pre id=' | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | <!-- vim: set foldmethod=manual : --> | ||
| + | </ | ||
| + | </ | ||
| + | {{: | ||
| + | </ | ||
| + | <WRAP half column> | ||
| + | |||
| + | ==== Résultat avec le thème clair ==== | ||
| + | <WRAP prewrap> | ||
| + | <code html event.py.light.html> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <meta charset=" | ||
| + | < | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | <!-- | ||
| + | pre { white-space: | ||
| + | body { font-family: | ||
| + | * { font-size: 1em; } | ||
| + | .LineNr { color: #af5f00; } | ||
| + | .Constant { color: #c00000; } | ||
| + | .Identifier { color: #008080; } | ||
| + | .Statement { color: #af5f00; } | ||
| + | --> | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <!-- | ||
| + | |||
| + | /* function to open any folds containing a jumped-to line before jumping to it */ | ||
| + | function JumpToLine() | ||
| + | { | ||
| + | var lineNum; | ||
| + | lineNum = window.location.hash; | ||
| + | lineNum = lineNum.substr(1); | ||
| + | |||
| + | if (lineNum.indexOf(' | ||
| + | lineNum = ' | ||
| + | } | ||
| + | var lineElem = document.getElementById(lineNum); | ||
| + | /* Always jump to new location even if the line was hidden inside a fold, or | ||
| + | * we corrected the raw number to a line ID. | ||
| + | */ | ||
| + | if (lineElem) { | ||
| + | lineElem.scrollIntoView(true); | ||
| + | } | ||
| + | return true; | ||
| + | } | ||
| + | if (' | ||
| + | window.onhashchange = JumpToLine; | ||
| + | } | ||
| + | |||
| + | --> | ||
| + | </ | ||
| + | </ | ||
| + | <body onload=' | ||
| + | <pre id=' | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | <span id=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | <!-- vim: set foldmethod=manual : --> | ||
| + | </ | ||
| + | </ | ||
| + | {{: | ||
| + | </ | ||
| + | </ | ||
