## ソースコードは対象言語を使う ````markdown ```python def main(): # Pythonならpython ``` ```` ↓ ```python def main(): # Pythonならpython ``` ````markdown ```python function main() { // TypeScriptならTypeScript } ``` ```` ↓ ```ts function main() { // TypeScriptならTypeScript } ``` ## 差分はdiffを使う ````markdown ```diff aaa - bbb + ccc ddd ``` ```` ↓ ```diff aaa - bbb + ccc ddd ``` diffではなくシンタックスハイライトを効かせたコードブロックをbefore/afterでそれぞれ記述した方が分かりやすい場合は、そのようにする。 ## エラーメッセージはerrorを使う ````markdown ```error ERROR - Config value 'markdown_extensions': Failed to load extension 'fontawesome_markdown'. ``` ```` ↓ ```error ERROR - Config value 'markdown_extensions': Failed to load extension 'fontawesome_markdown'. ``` 赤文字の太字で表示されるため一目でエラーと分かる。 ## コマンドラインはconsoleを使う 実行コマンドだけを記載するケース。 ````markdown ```console echo hello ``` ```` ↓ ```console echo hello ``` コマンドの結果も含める場合は、コマンドに`
のprefixをつける。 ````markdown ```console $ echo hello hello ``` ```` ↓ ```console $ echo hello hello ``` ````markdown ```console $ hogehoge hogehoge: The term 'hogehoge' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. ``` ```` ↓ ```console $ hogehoge hogehoge: The term 'hogehoge' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. ``` コマンドの結果がエラーとなる場合、上記の方法でも良いが、コマンドとエラーメッセージを分けたうえで、`error`を使ってもよい。 ````markdown ```console hogehoge ``` ```` ↓ ```console hogehoge ``` ````markdown ```error hogehoge: The term 'hogehoge' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. ``` ```` ↓ ```error hogehoge: The term 'hogehoge' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. ``` コメントブロックを含む場合は`bash`や`pwsh`を使った方が見やすい場合もある。 ````markdown ```bash # インストールする $ apt install ``` ```` ↓ ```bash # インストールする $ apt install ``` > [!note] > > `console`については[[GitHubでコードブロックに使える言語一覧]]を参考にした。なお、[[Editor Syntax Highlight]]では対応しておらず、独自に[[CSS]]で定義している。