Skip to content

Instantly share code, notes, and snippets.

@ideabucket
Last active December 30, 2022 15:53
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideabucket/5231db1261ed0f15bd59 to your computer and use it in GitHub Desktop.
Save ideabucket/5231db1261ed0f15bd59 to your computer and use it in GitHub Desktop.
BBEdit text filter to replace Markup → Tidy → Reflow XML

As of BBEdit 13.1, the HTML Tidy built-ins are back and you should use those instead. This gist is so old it refers to "OS X", c’mon!

If for some reason you are using this, note @ryanfrancesconi’s comment about the correct place to put the file when using sandboxed versions of BBEdit.

#!/usr/bin/env bash
# put this file in [Library location]/Application Support/BBedit/Text Filters/
# xmllint ships by default in recent versions of OS X
xmllint --format -
@kbanning
Copy link

Thanks, this is very helpful. I don't know why they removed Tidy but this should be a basic feature of an expensive text editor these days!

@markljackson
Copy link

I believe it was removed due to Tidy not being updated, and having "ownership" issues. If you look at the Tidy webpage, there is a gap from 2008 to 2015 when it sat idle.

@Telekor
Copy link

Telekor commented Dec 13, 2016

Thanks!

@2ec0b4
Copy link

2ec0b4 commented Jan 16, 2018

To use a Text Filter, select Menu_Bar > Text > Apply Text Filter > your_filter_name

Source: http://www.bbeditextras.org/wiki/index.php?title=Text_Filters

Thanks ;)

@ultrahuff
Copy link

Worked perfectly, thanks for the info.

@AdamLawicki
Copy link

Hey @ideabucket this looks legit, how do I install to BBEDIT?

@alexumn
Copy link

alexumn commented Mar 17, 2019

Thanks, this is super handy!

A quick usage note: Application Support/BBedit/Text Filters/ could be ~/Library/Application Support/BBEdit/Text Filters/.

@ryanfrancesconi
Copy link

Note for others arriving here: if it's a sandboxed version of BBEdit, this location won't exist and instead will be:

~Library/Containers/com.barebones.bbedit/Data/Library/Application Support/BBEdit/Text Filters

They have a short cut from the Folders menu.

@ryanfrancesconi
Copy link

This is still useful - not sure if there is a better option yet. BBEdit's Tidy is somewhat limited.

@ideabucket
Copy link
Author

This is still useful - not sure if there is a better option yet. BBEdit's Tidy is somewhat limited.

I'm extremely curious to know what the difference is. If it seriously is still useful I'll wrap it up in a .bbpackage to make installation simpler.

@ryanfrancesconi
Copy link

The difference is lack of control over how white space is handled... I don't know if tidy has some options that I haven't seen? I like that you can setup the lint to be however you want. I really only use it for quick syntax checks.

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