What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

I've been poking around Data Explorer looking for queries that can reliably turn up posts with questionable formatting or quality issues. I found that the behavior of the Markdown engine can be leveraged to find un-indented code blocks in the rendered HTML of posts.

I started editing a few of the posts I found already, but I realized that the queries could probably be incorporated into the query (queries?) used to automatically identify possible low quality posts for the /review path. Is this possible to implement?

It would certainly be superior to using Data Explorer to do this, as DE only gets fresh data every month or so, whereas the low quality posts in /review are re-evaluated much more often based on live data. And of course /review allows inline editing, much wider editor exposure, etc.

I'll give a list of queries here. If there are any other queries that would be useful, please add them to the list.

share|improve this question

2 Answers 2

We need a special one for meta: Posts that include the words "downvote" and "comment".

share|improve this answer
    
consider it done - 1309 results (!) –  Jason Plank Dec 1 '11 at 18:08

I submit another one for your review: http://data.stackexchange.com/stackoverflow/q/119812/posts-with-possibly-misformatted-code

Looks for posts containing <pre>[line feed character]<code>, a sign that someone tried to format code with hacky HTML instead of true Markdown.

share|improve this answer
    
Good find. Those never quite look right in rendered form. –  Jason Plank Dec 1 '11 at 16:58
    
A tip for editing these: if you find a lot of HTML entities such as &lt; (and/or unnecessary junk like <br>) in the post source, you can copy the rendered version of the post (before editing out the <pre><code>), then paste it over the old code in the editor and ctrl+K it. –  Jason Plank Dec 1 '11 at 16:59
    
I usually go one step farther by copying the code into Eclipse and using the code formatting tool. I do it to increase readability, but as a bonus, if formatting fails, you know there's a syntax error in there somewhere. I've found a lot of mismatched braces in terrible code that way. –  Pops Dec 1 '11 at 17:06
    
Hmm, apparently they can look right, you just have to be a little finicky about where you put the <pre><code> and </code></pre>. –  Jason Plank Dec 1 '11 at 17:19
1  
I believe it's the line feed that screws it up. The original version of this query didn't include the line feed, and it matched every post containing correctly formatted Markdown (because posts are saved in cooked HTML format, and Markdown's code blocks just get converted to <pre><code> blocks). EDIT: wait, no, I'm wrong! It's the new line after <code> that causes the odd appearance. It just so happens that all the examples I saw of a line feed between <pre> and <code> also had breaks after <code>. –  Pops Dec 1 '11 at 17:27
    
Yeah, I think you're right. See this answer, which probably could have saved us some work if I had remembered where it was before now. FWIW, the only good reason I see to use <pre><code> is that you can apply bold/italic within code blocks. But I'm not even sure that is worthwhile. –  Jason Plank Dec 1 '11 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .