I know it can be possible through a plugin that I am currently using but I don’t want any dependency in future. Also, Crayon Syntax Highlighter is not PHP 7 compatible. and it was updated last 4 year ago.

Unfortunately its not as simple as dropping some CSS on the site. CSS requires Markup and classes for its styles to be attributed to. That is what these plugins do.

The first plugin i mentioned uses Prism.js: https://prismjs.com
So if you’re really concerned about the plugin being abandoned you could implement this yourself. Or alternatively look at using GIST for serving up your code.