question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firefox add-on prevents line-breaks in code highlighted with PrismJS

See original GitHub issue

I don’t know how, but right now using Firefox Nightly (72) and consulting technical contents with code blocks (eg HTMHell), PrimsJS is unable to wrap content for line-breaks (trying to add a <span class="highlight-line"> for each line, but not throwing any error nor message…).

After double checking every settings and add-ons, it seems that this is prevented by the aXe webextension: with my current profile and every settings, simply disabling aXe made PrismJS wrapping correctly again…

I have no idea what’s doing this, but this sounds very curious!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
36degreescommented, Oct 27, 2020

I’m still seeing this happening in Chrome 86 with v4.6.1 of the extension.

For example, on https://www.11ty.dev/ I see

Text in inline code blocks collapsed onto a single line, with syntax highlighting removed

If I disable the axe extension, I see:

Text in inline code blocks displayed correctly, with syntax highlighting

It’s also stomping classes in other syntax-highlighted code blocks, removing the styling – for example on https://design-system.service.gov.uk/get-started/extending-and-modifying-components/ the extension replaces:

<pre><code class="lang-css"><span class="hljs-selector-class">.app-</span>\!<span class="hljs-selector-tag">-reference-number-width</span> {
  <span class="hljs-attribute">width</span>: <span class="hljs-number">10ch</span> <span class="hljs-meta">!important</span>;
}
</code></pre>

with:

<pre class="  language-css"><code class="  language-css"><span class="token selector">.app-\!-reference-number-width</span> <span class="token punctuation">{</span>
  <span class="token property">width</span><span class="token punctuation">:</span> 10ch <span class="token important">!important</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
0reactions
scurkercommented, Jan 15, 2021

We’re currently tracking an open issue here: #2686

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prism.js
Automatically loads the needed languages to highlight the code blocks. Keep Markup. Prevents custom markup from being dropped out during highlighting. Command ...
Read more >
PrismJS no line breaks - javascript - Stack Overflow
Not sure if anyone has come across this. I'm using PrismJS syntax highlighter to highlight code. Application is ...
Read more >
In Firefox 30 (Windows) "Style Editor" is adding breakes ...
Hello, After upgrading Firefox to v30 Style Editor started adding line breaks in CSS files. It makes working with CSS files very annoying....
Read more >
Prism
Extensible Define new languages or extend existing ones. Add new features thanks to Prism's plugin architecture. Easy styling All styling is done through...
Read more >
Prism Documentation - CodePen
var Prism = require('prismjs'); // The code snippet you want to highlight, ... Show invisible characters like tabs, line breaks etc (requires plugin) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found