Render source code files via QuickLook rather than as raw text?

It seems that the DT policy is to render all known text files as raw text regardless of extension, and to only use QuickLook plugins for files which are not known to be text. Would it be possible to override that behavior and allow the use of QuickLook for specific extensions (such as .cpp, .h, …)?

I sometimes put source code snippets into DT, and I also use a QuickLook plugin which does source code syntax highlighting (GitHub - sbarex/SourceCodeSyntaxHighlight: Quick Look extension for highlight source code files on macOS 10.15 and later.). I never want to edit these snippets inside DT and would prefer to have DT render them through this QuickLook plugin.

The obvious place for this option would be “Menu → View → Document Display → Best Alternative” but this seems to be disabled for all text-based files.

There is also an “AdditionalPlainTextExtensions” hidden preference. What I have in mind would be the opposite of that – take a known text extension and make it effectively unknown to DT so that DT is forced to render it via QuickLook like it does other unknown extensions.

Thank you for the suggestion! We’ll consider this for future releases but QuickLook-based views are rather limited and not editable. For on demand rendering the QuickLook panel might be an alternative.

I’ll keep my fingers crossed!

The QuickLook panel is quite good but it adds a few seconds of friction, doesn’t remember its size, and closes any other QuickLook panels.

The next release will support this on demand.

Thank you!