PrismJS copy-to-clipboard error

Ok thanks for the clarification, I also knew that it is always better to use fewer external links.
I read somewhere (perhaps some performance site) that it is not convenient to create js / css files that are too long, it is better to use several but shorter ones.
Do not you agree?

Thanks for letting me know. It will not happen again.

Hope I could be of any help.

1 Like

Where did you read this? I would bundle them into single files that are minified, that way they are at their smallest size and they can be cached by the browser.

@DavidDarnes it was pingdom or gtmetrix, i dont remember atm. I’ll let you know if i find it.

@gregpozo I appreciate that you have changed the answer. I noticed that you forced the publication of your site. Mine was just advice, not criticism.

2 Likes

No worries. Maybe I misinterpreted your point.

I use prismjs as well with a modified okaidia theme, so I just wanted to use it as reference. Thank you for the advice.

1 Like

I wish I could highlight one row or multiple rows using prismjs. It is quite clear to me how to do it, but I don’t know how to apply it using Koeing. Some idea?

https://prismjs.com/plugins/line-highlight/

I guess you’d need to apply the attributes later using JavaScript. Something like this:

document.querySelector('pre').setAttribute('data-line','1-5');

You might need to get a bit clever with the element selection though if you have more than one code block on the page

using the HTML card (assuming you added the CDN of line highlight to the code injection), do something like this:

<pre class="line-highlight" data-line="3"><code class="lang-css">.awesome-thing {
	display: block;
   	width: 100%;
    }</code></pre>

The output should be this:

.awesome-thing {
    	display: block;
       	width: 100%;
        }

Highlighting row #3
That should be enough. I’ll do a post about this since i found no one just explaining it in an easy way. Let me know if it works for you.

1 Like

@DavidDarnes I use more and more blocks of code. I will try to find something to solve the problem.

@gregpozo That way I can’t use the quick quotes of the editor? ``

No :frowning: (that’s the bad part if you want it the easy way).

Ultimately, it is the same thing, just a couple lines of code in addition. Just have it as a snippet and copy paste when needed.

2 Likes

Okay, it might still be the best solution right now. Thank you!

2 Likes