Old posts with unrendered fences


Please login or register to vote for this query.

(click on this box to dismiss)

Find posts that contain the tripe-backtick code fence syntax, but were last edited before Stack Exchange supported it (https://meta.stackexchange.com/questions/125148/implement-style-fenced-markdown-code-blocks/322000#322000), and are therefore not rendered correctly.

Ask Ubuntu

Q&A for Ubuntu users and developers

select p.Id as [Post Link],
       p.Score as [Score],
       p.ViewCount as [Views],
       p.CreationDate as [Created],
       p.LastEditDate as [Edited]
from Posts p
inner join PostHistory ph
on ph.PostId = p.Id
where p.LastEditDate <= Convert(datetime, '2019-01-08')
  -- ph is a body creation or edit or rollback
  and (ph.PostHistoryTypeId = 2 or
       ph.PostHistoryTypeId = 5 or
       ph.PostHistoryTypeId = 8)
  -- Look for markup that looks like code fences. This isn't perfect but
  -- should be close enough to be useful.
  and (ph.Text like '%' + char(10) + '```%' or
       ph.Text like '%' + char(10) + '    ```%' or
       ph.Text like '%' + char(10) + '        ```%')
  -- ph is the latest revision
  and not exists (
    select n.Id from PostHistory n
    where n.PostId = ph.PostId and n.Id > ph.Id
order by p.Score desc, p.CreationDate desc

Enter Parameters

Switch to meta site
loading Hold tight while we fetch your results