Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
react-syntax-highlighter
syntax highlighting component for react with prismjs or highlightjs ast using inline styles
-
react-native-syntax-highlighter
a syntax highlighter for react native using https://github.com/conorhastings/react-syntax-highlighter under the hood
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Yeah, if it really was just about a few lines then pure CSS would be doable if it was just for like a small blog post or something. Someone also suggested Carbon which is probably the easiest and best looking solution to the problem.
For the record, I'm not saying "just use a library" is an appropriate answer to the question either. I think a better answer would be to explain the complexities involved in syntax highlighting and the purpose and why you wouldn't try to do it with plain CSS. Then suggest, that if you want to do this, here's a great library you can use!