Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 1.03 KB

using-pygments.md

File metadata and controls

21 lines (16 loc) · 1.03 KB

How to add syntax highlighting with Pygments

Splash and its official plugin are great tools for highlighting Swift syntax when using Publish.

However, some people write not only in Swift, but also in many other languages. That's when SwiftPygmentsPublishPlugin can be really useful.

Please follow the plugin's installation guide to install Pygments and to add it to your website's Swift package, and then add it to your publishing pipeline:

import SwiftPygmentsPublishPlugin
...
try MyWebsite().publish(using: [
    .installPlugin(.pygments()),
    ...
    .addMarkdownFiles(),
    ...
])

Please refer to the usage guide to see how to specify syntax language and more.

Note that you will need to add CSS for Pygments to actually see the highlighted code.