Recognising logs as code?

Great!

Will this recognize logs as “code”? If not consider this a feature request.

How do you identify an extract from a log-file? I guess it would suffice to look for a date/time at the beginning of two consecutive lines.

Another question: will ir work when people are using quote-formating (>) instead of code fences?

1 Like

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

That’s exactly why I think it shouldn’t be ignored. People keep using quotes to “format” their code…

6 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.