Skip to content

List Formatting #1

Open
Open

Description

@jonXmack

I downloaded this script this morning and it is saving me SO much time. However there is an issue with how lists are generated.

return {"type": list_type, "children": children} needs to be updated to return {"listType": list_type, "type": "list", "children": children}.

Additionally I made a minor tweak so it simply returns the value to the clipboard rather than displaying it within the terminal

I added import subprocess at the top

And adjusted the final lines to

json_data = html_to_json(html_input)

print('JSON data copied to clipboard')
subprocess.run("pbcopy", text=True, input=json_data)

Finally, on macOS users will need to install BeautifulSoup with python -m pip install beautifulsoup4 --break-system-packages

Activity

  1. tomatic commented on Jul 25, 2025

    @tomatic
    Owner

    Thanks for that list fix, I applied it to main.

    Regarding copying to clipboard: pbcopy is OS-specific and doesn't exist for Linux, so I wouldn't want to add an OS dependency to an otherwise OS-independent script. Especially since you can just pipe the script's output to pbcopy or, on Linux, xclip.

    I also wouldn't recommend installing Python packages with the --break-system-packages option, as that might break system utilities that rely on specific package versions. It's much safer to create a virtual env with python3 -m venv /path/to/new/virtual/environment and then install all required packages to that environment and run the script within the environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions