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

prismjs line-numbers #38

Closed
cmilanf opened this issue May 4, 2017 · 3 comments
Closed

prismjs line-numbers #38

cmilanf opened this issue May 4, 2017 · 3 comments

Comments

@cmilanf
Copy link
Contributor

cmilanf commented May 4, 2017

It looks like since the update to use the autoloader, the line-numbers stopped working. I was not able to find the plugin in the code so I think this needs to be added somewhere.

function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,s=/\s*\bline-numbers\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(s.test(t.className)||s.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){s.test(e.element.className)&&(e.element.className=e.element.className.replace(s,"")),s.test(t.className)||(t.className+=" line-numbers");var n,a=e.code.match(/\n(?!$)/g),l=a?a.length+1:1,r=new Array(l+1);r=r.join("<span></span>"),n=document.createElement("span"),n.setAttribute("aria-hidden","true"),n.className="line-numbers-rows",n.innerHTML=r,t.hasAttribute("data-start")&&(t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)),e.element.appendChild(n)}}})}()
@godofredoninja
Copy link
Owner

@cmilanf 👉 In the following update I will add it

@cmilanf
Copy link
Contributor Author

cmilanf commented May 4, 2017

Thank you!

Ah, do not forget the corresponding CSS, it was missing too :) By the way, not related to this issue, I would be happy to contribute with pull requests to the dev branch, but I don't know how to build the site through webpack; some reference in the dev's README.md would be very welcome :)

@godofredoninja
Copy link
Owner

Hello @cmilanf

— This new version already includes the numbers for the lines 177b526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants