Skip to content

Fix array $before/$after handling in $insert - #4179

Open
akhilbharati244 wants to merge 2 commits into
PrismJS:v2from
akhilbharati244:fix-4173-array-insert
Open

akhilbharati244 wants to merge 2 commits into
PrismJS:v2from
akhilbharati244:fix-4173-array-insert

Conversation

@akhilbharati244

Copy link
Copy Markdown

Description

Fixes #4173.

The array form of $before and $after in $insert could throw a TypeError when the referenced token did not already have an entry in lang[all].

The array implementation now initializes the anchor object before assigning the token, consistent with the existing scalar implementation.

Changes

  • Fix $insert.$before with an array of token names.
  • Fix $insert.$after with an array of token names.
  • Add regression tests covering both cases.

Testing

The regression test covers both array $before and array $after behavior.

@netlify

netlify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dev-prismjs-com ready!

Name Link
🔨 Latest commit 505817a
🔍 Latest deploy log https://app.netlify.com/projects/dev-prismjs-com/deploys/6ad3a131303a7de877e579a5
😎 Deploy Preview https://deploy-preview-4179--dev-prismjs-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

languages.extend(): $insert with an array $before/$after always throws TypeError

1 participant