Closed Bug 1529886 Opened 7 years ago Closed 7 years ago

Line numbers in the code block do not align with the code

Categories

(developer.mozilla.org Graveyard :: Wiki pages, enhancement)

All
Other
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: thmmrth, Assigned: e7358d9c)

References

()

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

Attachments

(3 files)

What did you do?

1. Visit a document page with a grey code block, e.g., https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes

What happened?

The code and their line numbers are not aligned.

What should have happened?

The line numbers should be in the same lines corresponding to the code.

Is there anything else we should know?

Affected browsers:

  • Firefox Quantum @ 65.0.1 (64-bit)
  • Firefox Developer Edition @ 66.0b9 (64-bit)

This appears to be caused by the Prism update in bug 1520004.

Here's the section:

<pre class="brush: css no-line-numbers">
/* Any button over which the user's pointer is hovering */
button:hover {
  color: blue;
}</pre>

The no-line-numbers class is meant to suppress line numbers, as seen in static/js/syntax-prism.js:

if (!$pre.hasClass('no-line-numbers')) {
  // Prism upgrade requires adding a class to use line numbering
  $pre.addClass('line-numbers');
}

However, Prism 1.15's behaviour seems to have changed, and the line numbers are now added but not hidden, and not positioned in the proper place.

It's not clear to me what code change is needed. Updating the content is not practical. We may revert Prism 1.15.

Blocks: 1520004
Status: UNCONFIRMED → NEW
Ever confirmed: true

The solution would be to use CSS to hide the line numbers when the no‑line‑numbers class is applied.

Also, this only affects <pre> blocks with no‑line‑numbers.

Assignee: nobody → e7358d9c
Status: NEW → ASSIGNED

This seems to be solved by ExE Boss and live on the web. Should I close it?

Thanks for confirming Thammarith, and thanks for the quick fix ExE Boss.

Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: