Plugin always adds e-content div to post content. Should it?
Hi @dshanske et al! I'm seeing an odd behavior with HTML content: two <div class="e-content">s, one inside the other. I assume that's not expected? For example, this JSON request:
{
"type": ["h-entry"],
"properties": {
"name": ["foo"],
"category": ["reply"],
"content": [{"html": "well <em>ok</em> is <a href=\"http://yahoo.com\">that so</a> <a href=\"http://bar.org\">http://bar.org</a>"}],
}
}
results in this HTML:
<div class="entry-content clear">
<div class='e-content'><a class="u-in-reply-to" href="https://micropub.spec.indieweb.org/"></a></p>
<div class="e-content">
well <em>ok</em> is <a href="http://yahoo.com">that so</a> <a href="http://bar.org">http://bar.org</a>
</div>
</div>
<div class="syndication-links"></div>
</div><!-- .entry-content -->
I'm guessing because of this code?
https://github.com/indieweb/wordpress-micropub/blob/9bccb0bdc501a1dca9441b713811248e82f43191/includes/class-micropub-render.php#L96-L100
e-content is probably up to the theme, right? Should the plugin be injecting this extra e-content div?
Just FYI: What I do in my theme (or rather, plugin, but a theme could do the same) is I check if there's a .e-content in the post content already and only add the class if there isn't. (For some post types, it makes sense to have a, e.g., reply context outside of .e-context, and since---in my case---both are part of my post content I can't just add an overall e-content class. Hence the check.)
But I also completely override the Micropub post content in a filter callback, so ... That could work too, at least temporarily. Just remove the div in a filter.
There's a setting that disables it entirely which my Post Kinds plugin turns on... I have some ideas I might pursue though.
FWIW, I debugged this a bit more just now, and it's not specific to HTML content or JSON input, evidently the plugin always does this when it creates posts. Eg a form-encoded micropub request with content=fooey results in this content HTML:
<div class="e-content">
fooey
</div>
(I don't actually know what should happen here! Just adding info for now.)