Snipets tooling update

- update README
- generate-md.py: ignore trailing newlines when complaining about diffs
- all langs: add more dependencies to templates
- all langs: support @hide-start and @hide-end for multi-line hiding
- go: also allow one-line imports
- java: allow declarations other than `main` method
- python, typescript: implement `unshorten` for implicit imports and
  client initialization
- python: add mypy config as `datasets` lacks type py.typed
- python: hide `# mypy:` annotations
- typescript: add tsconfig that allows top-level `await`s
- typescript: depend on @types/node to fix `import ... from "crypto"`
This commit is contained in:
xzfc
2025-11-28 21:57:13 +00:00
parent 8d6772736d
commit cdfbd6538a
18 changed files with 1217 additions and 28 deletions
+2 -1
View File
@@ -34,8 +34,9 @@ def main() -> None:
log(f"Skipping unknown language file: {md_file}")
continue
lines = md_file.read_text().rstrip().splitlines()
lines = md_file.read_text().strip().splitlines()
if not lines[0].startswith("```") or lines[-1] != "```":
log(f"Can't parse snippet file: {md_file}, skipping")
continue
content = "\n".join(lines[1:-1]) + "\n"
content = lang.unshorten(content)