Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep links null target #34

VincentTam opened this issue Aug 13, 2019 · 2 comments


Copy link

commented Aug 13, 2019

Screenshot from 2019-08-13 10-11-07
Screenshot from 2019-08-13 10-11-23

(function copyHeadingLink() {
let deeplinks = document.querySelectorAll;
let deeplink = 'link';
if(deeplinks) {
document.body.addEventListener('click', function(event)
let target =;
if (target.classList.contains(deeplink) || target.parentNode.classList.contains(deeplink)) {
let newLink = target.href != undefined ? target.href : target.parentNode.href;

Should the existence of target be checked first, like this?

// Get the element, add a click listener...
document.getElementById("parent-list").addEventListener("click", function(e) {
	// is the clicked element!
	// If it was a list item
	if( && == "LI") {
		// List item found!  Output the ID!
		console.log("List item ","post-", ""), " was clicked!");


@VincentTam VincentTam self-assigned this Aug 13, 2019

@VincentTam VincentTam added the question label Aug 13, 2019


This comment has been minimized.

Copy link

commented Aug 13, 2019

There is an error on line 298 ... there is a missing argument. The copyHeadingLink() function is only supposed to target headings i.e H1 ... H6. The idea is that if the content is authored in markdown, it will automatically add id attributes to those headings. The ids act as links (deep links)

In retrospect, I think we can edit the script such that id attributes will be added irrespective of whether the content is authored in markdown 🤔 .

It's neither supposed to work on ordered nor unordered lists. I will be looking into that


This comment has been minimized.

Copy link
Collaborator Author

commented Aug 13, 2019

In this case, feel free to edit this part. I'm working on the part of Staticman.

onweru added a commit that referenced this issue Aug 13, 2019

@onweru onweru closed this Aug 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.