Skip to content

Instantly share code, notes, and snippets.

@Stvad
Last active August 17, 2021 21:01
Show Gist options
  • Save Stvad/bb095babb3dbaa5e71fc4e101463f765 to your computer and use it in GitHub Desktop.
Save Stvad/bb095babb3dbaa5e71fc4e101463f765 to your computer and use it in GitHub Desktop.
delete empty Roam blocks
empty = roamAlphaAPI.q(
'[:find ?uid :where [?x :block/string ?content] [?x :block/uid ?uid] [(clojure.string/blank? ?content)]]')
empty.map(it=>block(it[0])).filter(it=>it.children.length === 0 ).forEach(it=>{
roamAlphaAPI.deleteBlock({block: {uid: it.uid}})
})
@Stvad
Copy link
Author

Stvad commented Aug 17, 2021

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