![]() Here's a screenshot showing it in action: (It's currently in the v1.35 development branch if no unexpected problems arise, it should be part of the v1.36 stable release in a few weeks at most.) Still, while waiting for an official fix, I've added a client-side implementation of this feature to the SOUP user script. Your post appears to contain HTML tags that are malformed, mismatched or not permitted in posts, and which will be silently removed. Where possible, please use Markdown syntax instead of HTML. ![]() To enter code that contains the < symbol, please use proper code formatting (or write it as <). To (hopefully) keep the warning message from being triggered too often while you're halfway through typing a tag, it's only shown when you either click outside the edit box or stop typing for three seconds. You can dismiss the warning box by clicking it if dismissed, it will stay hidden until you fix all HTML errors in the post, after which it will reappear if you add any new errors. (This last bit was sort of accidental, but I've kept it for now, since it seems to work reasonably well. Suggestions for a better UX are welcome.) The way I detect when to show the popup is by setting up a custom Markdown converter hook that runs during the preview process, just before the normal SE HTML sanitization code. In the hook, I run the same sanitization code (conveniently exposed via the sanitizeHtml() and balanceTags() methods of StackExchange.MarkdownEditor) on a copy of the post content, and check if the output differs from the input. (To avoid false positives, I first preprocess the copy to strip any HTML comments and to replace link and image URLs with dummy placeholders.) If it does, I set a flag and start a timer to display the warning. The warning does not stop the post from being submitted, so even if it does somehow get triggered by mistake, it should be safe to ignore. (That said, please do let me know if that happens.) I'm not sure if I should add some kind of a confirmation step if you submit the post while the warning is still pending hopefully, the two-second delay is short enough to make that unlikely.Mark Briggs serves as chairman and CEO of Validity, a company he founded in partnership with Silversmith Capital Partners.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |