ubuntu.com icon indicating copy to clipboard operation
ubuntu.com copied to clipboard

Syntax Highlighting for code snippets

Open rajannpatel opened this issue 2 years ago • 2 comments

Summary

I would like syntax highlighting for shell scripts and python scripts.

Process

Code snippets will be inserted using Custom HTML blocks in Wordpress, following these examples: https://vanillaframework.io/docs/base/code

Current and expected result

There is no syntax highlighting on code snippets, on ubuntu.com, today: https://ubuntu.com/blog/planning-phased-ubuntu-22-04-enterprise-desktop-upgrades-with-landscape

A code block experience similar to this would be desirable: https://gist.github.com/rajannpatel/63bbc6aada41e0534ae5d09a098d0be7

Screenshot

image

rajannpatel avatar Mar 08 '22 12:03 rajannpatel

Thanks for raising Rajan, we'll investigate, we should have it already according to our design system recommendations (https://vanillaframework.io/docs/base/code#syntax-highlighting) - possibly it hasn't been implemented yet.

sowasred2012 avatar Mar 09 '22 09:03 sowasred2012

So we already have the necessary Prism files in ubuntu.com and you just need to include the .js & .css files in that page and add the appropriate classes to the code block. However, I am not sure how hard it would be to communicate this from word press to our blog builder, any ideas @carkod

petesfrench avatar Mar 24 '22 11:03 petesfrench