Skip to content

Instantly share code, notes, and snippets.

@johngian
Created January 23, 2024 11:14
Show Gist options
  • Save johngian/ef8b84c3f60903a4454ae39bac42c9c3 to your computer and use it in GitHub Desktop.
Save johngian/ef8b84c3f60903a4454ae39bac42c9c3 to your computer and use it in GitHub Desktop.
Beautify HTML using beautiful soup
import click
from bs4 import BeautifulSoup
@click.command()
@click.argument("path")
def main(path):
with open(path, "r") as f:
html = f.read()
pretty = BeautifulSoup(html).prettify()
click.echo(pretty)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment