Automattic / Automattic/jetpack

Math LaTeX module should specify image dimensions

Open
#17,981 2 comments 0 reactions 0 assignees View on GitHub
[Feature] Beautiful Math [Pri] Low Enhancement
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

I am using "Beautiful Math with LaTeX" to embed latex equations in my WordPress blog. This plugin module outputs the following image tag:

`...`

It does not specify the height and width attributes for images.

WordPress 5.5 update dynamically adds the height and width attributes to the images created with the Gutenberg editor. Beautiful Math with LaTeX should do the same thing (adding loading="lazy" width="..." height="..." to image tag) for the following two reasons.

(1) Images without the height and width attributes cause CLS (Cumulative Layout Shift), one of Core Web Vitals.

(2) AMP (Accelerated Mobile Pages) requires the dimensions to be specified in the image tag. See, for example, the following page of my blog.

[https://www.nagaitoshiya.com/ja/2012/indefinite-integral/amp/](url)

The latex equations in the comment form (No.9) are not displayed. Google Search Console warns me to fix the error of this page.

I hope the developers will fix this bug and improve the module.

Contributor guide

Open the contributing guide

Research direction

The issue identifies the Beautiful Math with LaTeX module as the entry point; locate the code that emits the image tag and inspect how the equation dimensions are available. Done means generated LaTeX images include loading="lazy", width, and height attributes and remain visible in AMP and comment output.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.