プレースホルダーフォームは非常に優れた公式コンポーネントです

I never used this theme component on my community websites as it was of no use.

But I also have my own personal, closed forum which I use for many purposes.

I’ve found placeholder forms incredibly useful for me. In particular, I use lengthy commands multiple times a week that I don’t remember and need to modify parts of each time.

The component allows me to quickly customize and copy-paste those commands in my terminal for immediate results.

Three examples of what I use it for :

Convert all pictures from a given format to JPG

Get-ChildItem -Filter *.=EXTENSION= | ForEach-Object { magick $_.FullName -quality =QUALITY= ($_.FullName -replace '\.=EXTENSION=$', '.jpg'); if (=DELETE_ORIGINAL= -eq 1) { Remove-Item $_.FullName } }

Add a delay on all .srt subtitles files from the current folder[1]

Get-ChildItem -Filter '*.srt' | ForEach-Object {
    $srtFile = $_.FullName
    $tempSrtFile = "$($srtFile).tmp.srt"

    Write-Host "Processing: $srtFile" -ForegroundColor Green

    ffmpeg -itsoffset =DELAY= -i "$srtFile" -c copy "$tempSrtFile"

    if (Test-Path -LiteralPath "$tempSrtFile") {
        Move-Item -LiteralPath "$tempSrtFile" -Destination "$srtFile" -Force
        Write-Host "Shifted $srtFile by =DELAY= second(s)." -ForegroundColor Green
    } else {
        Write-Host "Failed to process $srtFile. Check FFmpeg output." -ForegroundColor Red
    }
}

Clip and convert a given video file to H264, HEVC or lossless format

if ("=CODEC=" -eq "h264") { ffmpeg -ss =FROM= -to =TO= -i "=FILENAME=" -c:v libx264 -pix_fmt yuv420p -crf =COMPRESSION= -preset medium -c:a aac -b:a 192k -movflags +faststart "=FILENAME=-h264.mp4" } elseif ("=CODEC=" -eq "hevc") { ffmpeg -ss =FROM= -to =TO= -i "=FILENAME=" -c:v libx265 -pix_fmt yuv420p -tag:v hvc1 -crf =COMPRESSION= -preset medium -c:a aac -b:a 192k -movflags +faststart "=FILENAME=-hevc.mp4" } elseif ("=CODEC=" -eq "lossless") { ffmpeg -ss =FROM= -to =TO= -i "=FILENAME=" -c:v ffv1 -level 3 -g 1 -c:a pcm_s16le "=FILENAME=-=CODEC=.mkv" } else { Write-Host "Unknown codec: =CODEC="; exit 1 }

So far, it has been a very important feature for my personal Discourse – and thus for my everyday life – so I’m very happy it exists. :discourse:

The only downside is that I’d like the component to have a button shortcut because… I don’t remember the whole syntax to create the placefolder fields in a new topic and rely on copy-paste :sweat_smile:

Oh well, writing this topic made me have a look at the toolbar options and realize there is, indeed, a shortcut, which makes me feel both silly and happy :smile:
Another great thing about this component, then.


  1. This one is just a matter of replacing a single duration in the script, but it’s still easier for me to tweak it this way than changing the value directly in the code :face_with_tongue: ↩︎

「いいね!」 6

Thanks for the commentary! :blush:

I would be very glad if even more documentation platforms started including it.