Skip to content

Commit 9034243

Browse files
authored
FIx display of readme/changelog/license in Package Manager (#16829)
### What does it do? - **Backend:** Removes `htmlspecialchars()` before Parsedown in `GetAttribute` for readme/changelog/license. Markdown is parsed from raw text; empty attributes are handled with `$data ?? ''`. - **Frontend:** For the readme, changelog, and license tabs in Package Manager, the template uses raw substitution (`{[values.id]}`) so HTML from Parsedown is rendered without escaping. - **CSS:** Adds Markdown styles under `.meta-wrapper`: `pre`, `code`, `pre code`, and `p` (code blocks, inline code, paragraph spacing). Values use `rem` units. ### Why is it needed? Readme content during package installation was broken: paragraphs ran together, backticks and code blocks were not styled, and HTML was shown as literal text. This was caused by calling `htmlspecialchars()` before Parsedown and by escaping the resulting HTML in the template. ### How to test 1. Use a package whose readme.txt has paragraphs, `` `inline code` ``, a fenced code block, and HTML (e.g. `<br/>`). 2. Go to Extras → Install, choose the package, and open the Readme tab. 3. Confirm: paragraphs are spaced, inline and block code are visually distinct, and HTML is rendered instead of shown as text. ### Related issue(s)/PR(s) Resolves #16206
1 parent 208b50a commit 9034243

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

core/src/Revolution/Processors/Workspace/Packages/GetAttribute.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* This file is part of MODX Revolution.
45
*
@@ -77,8 +78,10 @@ public function process()
7778
$parseDown->setSafeMode(true);
7879
foreach ($attributesToGet as $attribute) {
7980
$data = $this->transport->getAttribute($attribute);
80-
$attributes[$attribute] = in_array($attribute,
81-
['changelog', 'license', 'readme']) ? $parseDown->text(htmlspecialchars($data)) : $data;
81+
$attributes[$attribute] = in_array(
82+
$attribute,
83+
['changelog', 'license', 'readme']
84+
) ? $parseDown->text($data ?? '') : $data;
8285

8386
/* if setup options, include setup file */
8487
if ($attribute === 'setup-options') {

0 commit comments

Comments
 (0)