-
Notifications
You must be signed in to change notification settings - Fork 354
Fix double escaping and decode HTML entities in backticks for command documentation #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…d files Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
@copilot I think the issue is actually some double escaping. Revert your changes. Then, make sure |
Per @swissspidy's feedback, the issue is double escaping. Changed the generator to convert &lt; back to < and &gt; back to > to prevent double escaping. - Reverted all markdown files to original state with <slug> - Added fix to prevent &lt; from being created by converting it back to < - Removed previous fix that was converting < to < Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
@copilot I think what we need to do is to decode HTML entities inside backticks. So that we for example have ``--theme= |
Per @swissspidy's feedback, HTML entities inside backticks should be decoded so that `--theme=<theme>` becomes `--theme=<theme>`. Added preg_replace_callback to decode HTML entities within backtick-enclosed code spans using html_entity_decode(). Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Done. Added regex to decode HTML entities inside backticks using |
Command documentation generator was double-escaping HTML entities and not decoding them inside backtick-enclosed code spans, causing incorrect rendering in generated files.
Changes
Generator fixes (
bin/Handbook_Command.php)&lt;back to<and&gt;back to>htmlspecialchars()processes content that already contains entitiespreg_replace_callbackto find backtick-enclosed code spanshtml_entity_decode()`--theme=<theme>`renders correctly instead of`--theme=<theme>`Problem
<slug>(HTML entities), thehtmlspecialchars()call on line 609 converts the&in<to&, resulting in&lt;slug&gt;(double-escaped) in the output.<theme>instead of<theme>in inline code.Impact
Future documentation generations will:
`--theme=<theme>`instead of`--theme=<theme>`on the websiteOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.