-
Notifications
You must be signed in to change notification settings - Fork 126
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
HTML on one line renders incorrectly #44
Comments
Also occurs when there is nbsp (u+a0) at the end of the line.
It seems only block elements do this. Inline elems are unaffected. Only Parsedown Extra is affected. |
I left a small donation hoping that it helps others resolve this. |
I'll see what I can do. It might take some time, though. I'll be quite busy over the next couple of weeks. |
Copy that :-) I'm a veteran with PHP, but new to Parsedown. Any ideas where I might start debugging this? If so I might be able to submit a PR for this. |
Sure, It's in the Parsedown does supports one line block-level elements, but it looks for a closing tag at the end of the line. It doesn't consider the element closed when it doesn't find a closing tag at the end of the line. You could give it a shot, but it might take me much less time to fix. Unless it's urgent, it might make more sense to wait. |
@erusev writes...
Thank you :-) I'll take a look at this in the next day or so and see what I can make of it. Otherwise, I'll wait patiently as suggested. |
I noticed an issue with a self closing element which ended in an endless loop. If an element doesn't have any children, the html should be appended directly and not through processText(). I've fixed this in: |
@storeman Can you provide an example that I can use to reproduce the issue? |
@storeman Ah, I see, thanks, I appreciate it. |
Had more issues today with the solution from @acmitch. I deleted my fork because i could not find the clear edge case where his solution was breaking my html. One of the issues was, textareas were replicated and the dom-structure was altered. For example:
Became
It was caused by the surrounding html, but those 13000 lines were to hard to walk through. |
@storeman thanks for the feedback! Found a few issues related to the code block you provided. <textarea></textarea>
<label><input type="checkbox"> <a href="#">Some test</a></label> The first issue, as you mentioned above, was that specific elements were causing endless loops. This has been fixed in my latest commit acmitch@468ecc6 It is important to note that all inline or voided HTML elements must be within the Therefore, to fix the protected $voidElements = array(
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'textarea'
); Once, that has been added you should be good to go (I've already tested and works like a charm)! Maybe @erusev can add the |
Here is a failing testcase if it would be of help:
Results:
|
@ericbarnes Thanks, Eric, I appreciate it, hopefully, I'll have some time later this month to address the issue. |
If you have HTML on a single line, only the first will render.
See this screenshot of the behavior from the demo.
Only happens in Parsedown Extra. Regular Parsedown is fine.
The text was updated successfully, but these errors were encountered: