Hugoの外部コマンド制限に対応し、「–editor=code」でVS Codeを利用できるようにする設定方法をまとめています。
環境#
- Windows 11
- Git Bash
- VS Code
- Hugo v0.148.2
セキュリティ設定(VS Codeを許可)#
Hugoでは外部コマンド実行が制限されており、そのままでは--editor=codeが使えません。
VS Codeを許可するためにconfig/_default/security.tomlを追加します。
Bash
tee config/_default/security.toml <<EOF > /dev/null
[exec]
allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^npx$', '^postcss$', '^code$']
EOF