Quantcast
Viewing latest article 9
Browse Latest Browse All 100

Make the editor hint users to add code fences when a curly brace in paragraph text leads into a code block

For curly-brace languages, it's not too difficult to find posts that are missing code fences with a high true-positive rate: Just find posts where paragraph text ends with an opening curly brace and leads into a code block (typically, four spaces in the markdown editor, but more if the code block goes with a list entry. You also need to be intentional about catching cases in blockquotes).

These can also be retroactively found via SEDE. Here's a query that finds recent examples (ones that start from 2023 and onward):

SELECT P.Id AS [Post Link], P.BodyFROM Posts PWHERE  P.Id >= 74972583 -- optimized version of CreationDate > '2023-01-01'  AND CHARINDEX('{</p>'+CHAR(10)+'<pre><code>', P.Body COLLATE Latin1_General_BIN) <> 0

How about having the editor detect this on the fly to give a hint about possibly missing code fences?


Viewing latest article 9
Browse Latest Browse All 100

Trending Articles