Skip to content

Instantly share code, notes, and snippets.

@oaustegard
Last active February 18, 2019 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oaustegard/e118c864e7e66b84af7db0d72c94b3d3 to your computer and use it in GitHub Desktop.
Save oaustegard/e118c864e7e66b84af7db0d72c94b3d3 to your computer and use it in GitHub Desktop.
Simple JS code for adding links to all headers on a Confluence page
javascript:AJS.$("[id]").filter(":header").each(function(){$(this).prepend("<a href='#"+$(this).attr("id")+"'>#</a>")})
<script type="text/javascript">
//prepend each header with a link to the header that can be used for ease of deep linking
AJS.$(document).ready(function(){
AJS.$("[id]").filter(":header").each(function(){
try {
$(this).prepend("<a href='#" + $(this).attr("id") + "'>#</a>");
} catch(e) { console.log(e) }
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment