Thanks for [2]! I had been searching through the Parsoid code base for "img", but instead I needed to find the absence of "img"!
So img tags are not whitelisted, and thus are they are treated as a literal string. By default the PHP parser does the same thing, but there's $wgAllowImageTag to allow img tags. I added the following to WikitextConstants.js and now external images appear to be working in VE as I'd like them to:
if ( true /** replace with configuration option to allow <img> ?? :-) **/ ) { WikitextConstants.Sanitizer.TagWhiteList.add( "IMG" ); }
I totally understand that bare image tags are not ideal in many cases, but they're acceptable in my use case. I'm sure many other intranet wikis would agree. Any chance an option similar to $wgAllowImageTag could be added to Parsoid?
--James
On Tue, Feb 23, 2016 at 2:55 PM, Subramanya Sastry ssastry@wikimedia.org wrote:
On 02/23/2016 02:46 PM, James Montalvo wrote:
Why does it treat the img tag as a literal string, but not an h2 tag, for example?
This is what the PHP parser does as well You can try it in a sandbox [1], for example.
That is understandable because bare image tags can link to all kinds of external images that is not necessarily desirable (among other problematic uses of images out there in the wild that don't belong on wikipedia). Image-specific markup via [[..]] is how image display is controlled, and all other bare image tags (just like bare A-tags) are excluded among other tags. See [2] for the full list of whitelisted tags.
Subbu.
[1] https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox [2] https://github.com/wikimedia/parsoid/blob/master/lib/config/WikitextConstant...
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l