3 ms·
HN displays code just fine if you put four spaces in front of each line, like this: #!/usr/bin/env -S uv run # /// script # requires-python = ">=3.
by simonw 2y ago
HN displays code just fine if you put four spaces in front of each line, like this:
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "google-api-python-client",
# "google-auth-httplib2",
# "google-auth-oauthlib",
# "selenium",
# "webdriver_manager",
# "pydantic",
# ]
# ///
import argparse
import datetime
I built a tool to help me do that: https://observablehq.com/@simonw/wrap-text-at-specified-width https://observablehq.com/@simonw/wrap-text-at-specified-widt...
Edit: Huh, two spaces works too:
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.12"
- Jtsummers 2y agoTwo spaces, Reddit is the four spaces one. Two spaces Four spaces
- cozzyd 2y agowhich is the right choice as :set ts=2 is obviously correct
- stavros 2y agoThanks Simon, I guess it was a brain fart, because I'm sure I've used this formatting a lot in the past.
- Flimm 2y agoHere are the official formatting guidelines: https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc