Open BobRay opened 2 years ago
The code above, and the code I've created for packages is rendered perfectly at https://parsedown.org/demo.
Also, MODX 2.8.4, which uses Parsedown 1.0.0 doesn't parse links correctly.
If this is about how it's shown, screenshots would be useful. Wouldn't be the first time the mess that is ExtJS has styles that break plain markup!
If it's actually parsing the content wrong, then that's certainly peculiar.
Is this from a specific package people can try to install for testing? I doubt anyone is going to build an extra just to test this out.
Any extra will do, at least on my local machine. Click on Install or Re-Install, then click on the readme tab. The Login package is probably the most obvious example. Here's a link to a screenshot.
I think all three installation tabs are being rendered as plain text, no matter what the content is or what the file extension is. HTML tags, like the backticks in the screenshot, are rendered literally and have no effect on the output. The effect is the same in Chrome and Firefox.
There is another problem: the first text field (apparently set to :focus) in the package section is always scrolled down, which is inconvenient.
Hm, it looks to me like it should always be parsed as markdown: https://github.com/modxcms/revolution/blob/3.x/core/src/Revolution/Processors/Workspace/Packages/GetAttribute.php#L81
Maybe the htmlentities is breaking things? Of course we do want to avoid executing arbitrary code from a changelog or readme... but that's what safemode is probably for.
It's definitely the htmlentities()
call (though I can't see why). Removing it returns things to normal. I was unable to find the equivalent code in MODX 2.8.4, but it has the same problem.
Bug report
Summary
When installing a package in Package Manager, the rendering of Markdown content is seriously strange when viewing the Readme tab.
Step to reproduce
It's difficult to illustrate the problem here, but try this code in a readme.txt for a package (without the triple backticks at each end), then look at the Readme tab when installing it. Add a code section between sets of three backticks somewhere below.
Observed behavior
Output is nothing like what you would expect.
Expected behavior
Should be rendered like normal Markdown with HTML tags outside of code sections interpreted as HTML tags.
Environment
MODX 3.0.1 makes more of a mess of things. MODX 2.8.4 also renders backticks literally, but does not convert opening HTML tag tokens as entities. It preserves space between paragraphs, but it also renders text between single backticks the same as regular text (and displays the backticks). It also does not display code between three backticks as monospace and without any highlighting.