(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. 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. (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.
Text deduplicator java app 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. 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.
Suggestions for a better UX are welcome.)
(This last bit was sort of accidental, but I've kept it for now, since it seems to work reasonably well. 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. 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.
To enter code that contains the < symbol, please use proper code formatting (or write it as <). Where possible, please use Markdown syntax instead of HTML. Your post appears to contain HTML tags that are malformed, mismatched or not permitted in posts, and which will be silently removed. 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. What's most annoying is that this would be fairly trivial for SE to fix - there's a specific piece of code in the Markdown sanitizer that replaces unrecognized HTML-tag-like things with an empty string, and it should not be hard to make it trigger a warning when the post is being submitted. The faster questions with that little effort spent on them are moved to trash, the better.
Text deduplicator java app how to#
Adding a blockage for people who don't know how to indent a block of HTML sounds about fair.Īs for Frédéric's comment, paraphrasing "This might cause posters to remove the offending code from their post altogether, making the question unsalvageable": good. We already have warnings in place for posts that seem to be code-only. I'm all for blocking posts that are malformed. It is not that hard to look twice at what you're about to post. Like the poster doesn't care, or doesn't see, what their post looks like. I'm curious why posts looking like that get posted. There's people who use backticks (``) for entire code blocks (should be used for inline code only), users posting code in tags (no highlighting), users not indenting their code at all (so the first and last line are seen as text), and so on. I don't know why half of the posts I encounter have formatting errors. For developers, who work with text all day, using either of those markup languages should not be any problem, especially when you get a nice auto-updating preview of your post below your text area. There are basically three ways to perform rich text markup of posts on the web: HTML, BBCode and Markdown, with or without a WYSI(NQ)WYG GUI.