Summary Files Commits Branches @commit @diff @stats
path: root / demo / awk-scripts / Heading-anchors.awk
blob: 7216c6d96c75724fe3d1eb6d0ab07fb5142f213a (plain) (blame)
1
2
3
4
5
6
7
# .*\.html
# Adds an HTML anchor after every header element (except h1), with an href to that header

/<h[23456]/ {
	match($0, /id="[^"]*"/)
	$0 = $0 ORS "<a href=\"#" substr($0, RSTART + 4, RLENGTH - 5) "\">&sect;</a>"
}