Skip to content

Instantly share code, notes, and snippets.

@notmayo
Created March 27, 2026 19:58
Show Gist options
  • Select an option

  • Save notmayo/7d90b4eec12f79fd758261a99c1a02ea to your computer and use it in GitHub Desktop.

Select an option

Save notmayo/7d90b4eec12f79fd758261a99c1a02ea to your computer and use it in GitHub Desktop.
Confluence HTML export - Find all macros used in pages
grep -I -o '<[^>]*macro[^>]*>' ./*.html \
| grep -Fv 'src=confmacro' \
| awk '
{
tag=$0
out=tag
if (match(tag, /class="[^"]*macro[^"]*"/)) {
out=substr(tag, RSTART+7, RLENGTH-8)
} else if (match(tag, /class='\''[^'\'']*macro[^'\'']*'\''/)) {
out=substr(tag, RSTART+7, RLENGTH-8)
} else if (match(tag, /aria-label="[^"]*"/)) {
out=substr(tag, RSTART+12, RLENGTH-13)
} else if (match(tag, /[[:alnum:]_-]*macro[[:alnum:]_-]*/)) {
out=substr(tag, RSTART, RLENGTH)
}
gsub(/rbtoc[0-9]+/, "rbtoc", out)
if (!seen[out]++) print out
}' | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment