erusev / parsedown-extra

Markdown Extra Extension for Parsedown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Placeholder attribute is being removed

bastianallgeier opened this issue · comments

When you have some inline html in your Markdown like:

<div><input placeholder="test"></div>

…the word "placeholder" gets removed and leaves a broken attribute.

Has anyone found a workaround for this that doesn't involve js?

It looks like this is a bug with parsedown using the string placeholder as a literal placeholder, and str_replace-ing that. Would changing placeholder in the parsedown PHP to something like PD_PLACEHOLDER fix the issue? (I'd like a sanity-check before making a pull request.)

        # because we don't want for markup to get encoded
        $DOMDocument->documentElement->nodeValue = 'placeholder';
        $markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
        $markup = str_replace('placeholder', $elementText, $markup);

@maxfenton that's correct, it should be resolved now

@hkdobrev could u have a quick look at the failing build at https://travis-ci.org/erusev/parsedown-extra/jobs/85614579

the failure seems related to late static binding

if the problematic test is too complicated to fix, i'd rather remove it as the instance method, that it tests, is sth that's unlikely to change in future

@erusev It's failing, because ParsedownExtraTest extends ParsedownTest and this way PHPUnit executes both testsuites. I don't think that's needed. However if you really want to keep it this way, we'll need to change the way the TestParsedown.php file is loaded.

it extends ParsedownTest because we want to make sure that "extra" doesn't break the handling the rest of the original syntax