Skip to content

fix: allow unclosed single quotes in php-template (fixes #4152)#4374

Open
KJyang-0114 wants to merge 1 commit intohighlightjs:mainfrom
KJyang-0114:fix/issue-4152-php-template-apostrophe
Open

fix: allow unclosed single quotes in php-template (fixes #4152)#4374
KJyang-0114 wants to merge 1 commit intohighlightjs:mainfrom
KJyang-0114:fix/issue-4152-php-template-apostrophe

Conversation

@KJyang-0114
Copy link
Copy Markdown

Description

Fixes issue #4152 where a single apostrophe (unclosed quote) in php-template breaks highlighting for everything after it.

Problem

In php-template, an unclosed single quote like causes the entire remainder of the document to not be highlighted correctly. The issue does not occur in regular PHP mode.

Solution

Removed the skip: true property from the inherited APOS_STRING_MODE and QUOTE_STRING_MODE in php-template.js. This allows the parser to handle unclosed quotes more gracefully without breaking subsequent highlighting.

Testing

Added a test case in test/markup/php-template-apostrophe/default.txt that reproduces the issue from the bug report.

Reproduction

<?php
// This won\'t be highlighted unless there is another 
// single apostrophe later.
?>
<p>Some HTML <?= '\code' ?></p>

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.

1 participant