Create a list of headlines - jaap-karssenberg/zim-wiki GitHub Wiki
Create a file.sh with the following content:
#!/bin/bash
#print =headlines = ...
cat | pcregrep -o1 -i '^\={1,6}([^=].*[^=])={1,6}$'
Create a custom command using the following and check the "..replace current selection":
/path/to/file.sh %f