DEV Community

Konnor Rogers
Konnor Rogers

Posted on

3 1

Writing code block highlighting to a CSS file with Rouge.

Purpose

To remind myself how to do this again in the future.

How to do it?

To append a Rouge theme to an existing file you can do the following:

gem install rouge
irb

require "rouge"
theme = Rouge::Themes::Github.new.render
File.open("<path-to-file>", "a+") { |f| f.write(theme) }
Enter fullscreen mode Exit fullscreen mode

All themes

https://github.com/rouge-ruby/rouge/tree/master/lib/rouge/themes

Top comments (0)

Image of Stellar post

🚀 Stellar Dev Diaries Series: Episode 1 is LIVE!

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

If this article made your day, feel free to drop a ❤️ or share your thoughts in the comments!

Understood