Unformatted Code Detector

It will recognize logs as code if they happen to “look like” code (i.e. contain any of the patterns that would flag a post as containing code). You can test it out on your content at the demo link.

There are lots of ways to format a datetime, and not all log formats start each line with a datetime in any case. I guess detecting full ISO8601 representations (1970-01-01T00:00:00+00:00 etc.) would work, as these are very unlikely to appear outside of code or logs.

Anything in code blocks (fenced or indented) is ignored. Quoted blocks don’t receive any special treatment. Quoted blocks aren’t a correct way to format code, and may lead to unexpected results.

Example: the string <xml />

Block quoted (gets parsed away into oblivion):

Code fences (displays as intended):

<xml />
4 Likes